Authorization System Or Directory Access?

Hello!

The problem is: site stops working after move to another hosting.

What does it looks like:

  1. If i create domain “php as cgi” - site works, but authorization is not. I’ve noticed that it goes ok while it’s redirecting it to the home page:



if($model->validate() && $model->login()){

    // here it's user from DB - logged in

    $this->redirect(Yii::app()->baseUrl . "/index.php/mycontroller/index");

    // heare it's already Guest - not logged in

} 



So, i guess it can be connected with directory access. For example Yii every new request create a new entity and need an access to write it in directory. But i don’t know which one and how can i set it by myself.

  1. If i create domain "php as apache module" - site crushing with an error:

If i make all the site with rights “777 www-data” - it works. But again except authorization module. Same rights to framework folder doesn’t change anything.

htaccess doesn’t help either. I put


# for php as apache module

#Options +FollowSymLinks

#RewriteEngine On

#RewriteCond %{REQUEST_FILENAME} !-f

#RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule . /index.php [L]


# for php as fast-cgi

#RewriteEngine On

#RewriteBase /

#RewriteCond %{REQUEST_FILENAME} !-f

#RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

in all possible combination with php as apache or cgi, but nothing happened.

Now i see two ways - rewrite authorization system by ground or give more and more access to www-data, while i won’t found that directory it need access to.

Here is tutorial for my authorization system(sorry, can’t find it in english).

If you know something about it - please help.

PHP Fatal error: require(): Failed opening required ‘/site/folder/protected/config/main.php’

And what is the path where config.php really exists?

Is the application hosted as alias url ‘http://domain.com/alias’ ?

If so, you have to set the RewriteBase;





RewriteEngine on


RewriteBase /alias/ # Add the alias as RewriteBase


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule . index.php



Real path to yii-config is ‘/var/www/admin/data/www/mydomain.com/protected/config/main.php’. Config is really there. Am i understand you right or you mean by config.php something else?

Site hosted on technical domain like ‘http:://sub.sub.provider.com/index.php/site/page’.

Your htaccess commands caused an error:


Internal Server Error


The server encountered an internal error or misconfiguration and was unable to complete your request.


Please contact the server administrator, my@mail.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.


More information about this error may be available in the server error log.


Apache/2.2.16 (Debian) Server at sub.sub.mydomain.com Port 80

What is really strange - no error log messages after login. Just relogin as Guest.

I’ve tried to move site in directory with same name as technical domain(sub.sub.mydomain.com) - and again no reaction.

I’VE FOUND IT!!!

Problem 'caused by my crooked hands. At login form mutch earlier was checkbox like “remeber/don’t”. Attribute, which save it’s value $this->rememberMe, processed in model like this:


public function login()

    {

        if($this->_identity===null)

        {

            $this->_identity=new UserIdentity($this->username,$this->password);

            $this->_identity->authenticate();

        }

        if($this->_identity->errorCode===UserIdentity::ERROR_NONE)

        {

            $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days

            Yii::app()->user->login($this->_identity,$duration);

            return true;

        }

        else

            return false;

    }

Then i just delete it from form and didn’t check proccessing in model.

At the original server attribute get value ‘true’. So, logging in happen as always and i didn’t noticed any errors.

At the new one - attribute get value ‘false’ and session closed at the start. So, there was no error messages or something in logs - obviously it’s usual procedure.

That’s all. Thank you for attention.

P.S.: to moderators. Please, close this theme - this is the end.