解決PHP5.6版本“No input file specified”的問題
阿新 • • 發佈:2019-02-13
問題描述:使用TP框架做專案時,在啟用REWRITE的偽靜態功能的時候,首頁可以訪問,但是訪問其它頁面的時候,就提示:“No input file specified.”
原因在於使用的PHP5.6是fast_cgi模式,而在某些情況下,不能正確識別path_info所造成的錯誤
預設的.htaccess裡面的規則:
修改後的偽靜態規則,如下:
原因在於使用的PHP5.6是fast_cgi模式,而在某些情況下,不能正確識別path_info所造成的錯誤
預設的.htaccess裡面的規則:
IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f“No input file specified.”,是沒有得到有效的檔案路徑造成的。RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
修改後的偽靜態規則,如下:
IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]僅僅就是在正則結果“/$1”前面多加了一個“?”號,問題也就隨之解決了。</IfModule>