拿到一個二次開發的php項目代碼,同事說環境可隨便配。
數據庫準備好,代碼丟到虛擬機裏之後,
發現有個.htaccess文件,應該用apache,
但我配了個nginx...
好在htaccess中只有一行代碼,引入一個url
php_value include_path ".:/usr/share/pear:/usr/share/php:/vagrant/code/lib"
所以只需在nginx的配置文件中也引入所需路由即可
homestead的nginx配置文件地址:
/etc/nginx/sites-available
打開對應項目配置文件,
在location ~ \.php$ 對象中加入你的url即可
fastcgi_param PHP_VALUE "include_path=.:/usr/share/pear:/usr/share/php:/vagrant/code/lib";
同組的同事因爲沒做過php開發,對php環境搭建不熟悉,
在環境搭建過程中關於.htaccess也遇到了問題。
他是apache,但項目無法運行
頁面報500
查看error log,顯示
D:/WWW/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
由於怎麼修改都沒有成功,
於是我直接刪除.htaccess文件,
在php.ini中定義include path
include_path = ".;/usr/share/pear;/usr/share/php;D:/phpstudy_pro/WWW/stamp/lib"
項目成功運行。
(一般情況不要刪文件這麼衝動。。。)