1. 程式人生 > >nginx下搭建tp5的開發環境,問題及處理過程

nginx下搭建tp5的開發環境,問題及處理過程

nginx下搭建tp5的開發環境

error1

 

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專案)