nginx下搭建tp5的开发环境
0.500无相应(/头大/)
1.打开 php.ini 搜索 display_errors,把 Off 修改为 On就开启了 php 错误提示,这时再访问之前白屏的页面就会出现错误信息。
Warning: require(): open_basedir restriction in effect. File(/home/wangyetao/Document/dev_php_projects/hashroom/thinkphp/start.php) is not within the allowed path(s): (/home/wangyetao/Document/dev_php_projects/hashroom/public/:/tmp/:/proc/) in /home/wangyetao/Document/dev_php_projects/hashroom/public/index.php on line 18
Warning: require(/home/wangyetao/Document/dev_php_projects/hashroom/thinkphp/start.php): failed to open stream: Operation not permitted in /home/wangyetao/Document/dev_php_projects/hashroom/public/index.php on line 18
Fatal error: require(): Failed opening required '/home/wangyetao/Document/dev_php_projects/hashroom/public/../thinkphp/start.php' (include_path='.:/usr/local/php/lib/php') in /home/wangyetao/Document/dev_php_projects/hashroom/public/index.php on line 18
2.修改/usr/local/nginx/conf/fastcgi.conf去掉末尾行后
这行:fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
3.出现错误:
scandir() has been disabled for security reasons
lnmp -- 解决Warning: scandir() has been disabled for security reasons in…的问题
原因:LNMP 0.9禁用了部分存在危险的PHP函数
LNMP0.9禁用的PHP函数包括:passthru, exec, system, chroot, scandir, chgrp, chown, shell_exec, proc_open, proc_get_status, ini_alter, ini_alter, ini_restore, dl, pfsockopen ,openlog, syslog, readlink, symlink, popepassthru, stream_socket_server, fsocket, fsockopen
解决方法:
lnmp环境中编辑PHP配置文件:
vi /usr/local/php/etc/php.ini进入编辑状态
输入/,进入搜索模式,找到disable_functions
寻找disable_functions字符串,将后面的scandir删除
重启PHP生效
/etc/init.d/php-fpm restart
4.failed to open stream: Permission denied
解决办法 删除原runtime/文件夹下文件,chmod 777 runtime/
-->刷新浏览器,查看项目,搭建起来了(这番配置修改后,没有影响lnmp安装时附带的经典phpmyadmin项目)