拿到一个二次开发的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"
项目成功运行。
(一般情况不要删文件这么冲动。。。)