Closed lanmower closed 9 years ago
Please use forums to find out about webserver config. GitHub is for framework issues and feature requests. Thanks.
thanks for the response Samdark, I have spent several days eliminating webserver config from the possible problems, I have taken the following steps to eliminate that possibility:
the webserver is confirmed to be vanilla by reinstalling as ubuntu and loading virtualmin an additional webserver was set up with a different operating system (debian) and a different web hosting configurator (sentora) yii1 installation tested on the same webserver config in both cases, the error does not happen in yii1 yii2 installation tested in a path next to the yii1 installation, the problem occurs
If you have further suggestions to test to confirm that its not the webserver config, please name them, otherwise, please do not close this issue.
Also, are you sure your .htaccess
works?
The htaccess file has been debugged for problems, and is confirmed to lead to index.php on the problematic posts, a paste of the .htaccess config is in the issue above, apache error and access logs have been checked.
If a blank route ("") is configured in url manager, that blank routes action displays for all urls.
It is set up according to the guidelines set out in that guide, as well as using the concepts outlined in the following post http://www.yiiframework.com/wiki/755/how-to-hide-frontend-web-in-url-addresses-on-apache/ and/or the following thread answers http://www.yiiframework.com/forum/index.php/topic/47615-yii-20-basci-app-i-miss-the-htaccess-file/
The same .htaccess file with the same project files has been copied to a wamp testbed on another computer and is confirmed to work in that environment, but does not work on either of the linux installations.
In your case it seems that while being redirected to index.php, request looses arguments list.
Try dumping $_SERVER
on machine that works and on machine that does not and comparing them.
on the testbed server that works there are the following variables that may be the current route: 'REQUEST_URI' => string '/oauth2/token' (length=13) 'REDIRECT_URL' => string '/oauth2/token' (length=13)
on the linux servers that dont work there are the following variables that may be the current route: 'REQUEST_URI' => '/yii2/page' 'REDIRECT_URL' => '/yii2/page' 'SCRIPT_URL' => '/yii2/page' 'REDIRECT_SCRIPT_URL' => '/yii2/page'
doesn't look like anything is missing from the problematic server.
Here is the yii log dump, with this url the /bla url path was used, but the error says 'Unable to resolve the request "".', instead of "bla".
2015-07-28 21:14:56 [105.237.173.60][-][-][error][yii\web\HttpException:404] exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "".' in /home/**_/public_html/yii2/vendor/yiisoft/yii2/base/Module.php:461 Stack trace:
Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in /home/**_/public_html/yii2/vendor/yiisoft/yii2/web/Application.php:95 Stack trace:
2015-07-28 21:14:56 [105.237.173.60][-][-][info][application] $_COOKIE = [ 'PHPSESSID' => '09apjr1llefl9dmmui2he4qke4' 'login_type' => 's:8:\"username\";' '_csrf' => 'HET31Cp5J3FCgWBpQGqwdRBdWeI-X1po' ]
$SERVER = [ 'PHPRC' => '/home/**/fcgi-bin/../etc/php5' 'SCRIPTFILENAME' => '/home/**/publichtml/yii2/application/api/www/index.php' 'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 'PWD' => '/home/**/fcgi-bin' 'SHLVL' => '0' 'PHP_FCGI_MAX_REQUESTS' => '99999' 'CONTENT_LENGTH' => '0' 'SCRIPT_NAME' => '/yii2/application/api/www/index.php' 'REQUEST_URI' => '/yii2/bla' 'QUERY_STRING' => '' 'REQUEST_METHOD' => 'GET' 'SERVER_PROTOCOL' => 'HTTP/1.1' 'GATEWAY_INTERFACE' => 'CGI/1.1' 'REDIRECT_URL' => '/yii2/bla' 'REMOTE_PORT' => '50686' 'SERVER_ADMIN' => '[no address given]' 'CONTEXT_DOCUMENTROOT' => '/home/**/public_html' 'CONTEXT_PREFIX' => '' 'REQUEST_SCHEME' => 'http' 'DOCUMENTROOT' => '/home/**/public_html' 'REMOTE_ADDR' => 'zzz.xxx.ccc.vvv' 'SERVER_PORT' => '80' 'SERVER_ADDR' => 'xxx.yyy.zzz.aaa' 'SERVERNAME' => '**' 'SERVER_SOFTWARE' => 'Apache/2.4.7' 'SERVER_SIGNATURE' => '' 'HTTP_COOKIE' => 'PHPSESSID=09apjr1llefl9dmmui2he4qke4; login_type=s%3A8%3A%22username%22%3B; _csrf=HET31Cp5J3FCgWBpQGqwdRBdWeI-X1po' 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8' 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, sdch' 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36' 'HTTP_UPGRADE_INSECURE_REQUESTS' => '1' 'HTTPACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/_;q=0.8' 'HTTP_CACHE_CONTROL' => 'max-age=0' 'HTTP_CONNECTION' => 'close' 'HTTPHOST' => '**' 'SCRIPTURI' => 'http://**/yii2/bla' 'SCRIPT_URL' => '/yii2/bla' 'REDIRECT_STATUS' => '200' 'REDIRECT_SCRIPT_URI' => 'http://***/yii2/bla' 'REDIRECT_SCRIPT_URL' => '/yii2/bla' 'FCGI_ROLE' => 'RESPONDER' 'PHP_SELF' => '/yii2/application/api/www/index.php' 'REQUEST_TIME_FLOAT' => 1438107296.6612 'REQUEST_TIME' => 1438107296 ]
In your php.ini
set cgi.fix_pathinfo
to false
: https://secure.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo
Added to php.ini, no changes to output.
Do you still want me to move this matter to the forum as a webserver config issue?
Yes since as an issue it's not useful. I cannot reproduce it therefore cannot fix it.
Thanks for your time samdark, I'll move it over.
when a route is entered as follows:
http://domain/yii2/page
The following unexpected error displays
Not Found (#404)
Unable to resolve the request "". The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
The route variable is empty?
What is expected is Unable to resolve the request "page".
changing 'enablePrettyUrl' => true, to 'enablePrettyUrl' => false, and using
http://domain/yii2/?r=page
displays the correct error page namely:
Not Found (#404)
Unable to resolve the request "page". The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
on the same server, in yii1 http://domain/yii1/page works just fine, route always appears.
uname -r
3.19.0-23-generic
cat .htaccess
IndexIgnore / RewriteEngine on RewriteCond %{REQUEST_URI} !^/(yii2/application/api/www) RewriteRule (.*) /yii2/application/api/www/$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /yii2/application/api/www/index.php