1. 程式人生 > 其它 >安裝tp6專案,初始顯示“該網頁無法正常運作”,沒有顯示報錯內容

安裝tp6專案,初始顯示“該網頁無法正常運作”,沒有顯示報錯內容

版本:PHP版本7.1.7;專案thinkphp6.0.9

問題:訪問時報錯“該網頁無法正常運作

找到問題:PHP配置檔案php.ini找到以下兩個配置項修改為On,並予重啟php

       display_errors = Off  修改  display_errors = On
  display_startup_errors = Off  修改  display_startup_errors = On
重啟PHP:service php-fpm restart

重新整理網站報錯(當前網站問題報錯)

Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/new_tp6/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/new_tp6/public/:/tmp/:/proc/) in

/home/wwwroot/new_tp6/public/index.phpon line15

Warning: require(/home/wwwroot/new_tp6/vendor/autoload.php): failed to open stream: Operation not permitted in/home/wwwroot/new_tp6/public/index.phpon line15

Fatal error: require(): Failed opening required '/home/wwwroot/new_tp6/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in/home/wwwroot/new_tp6/public/index.php

on line15

當前問題:是phpopen_basedir 配置的問題,PHP不能引入其授權目錄上級及其以上的檔案;

     一般情況下是不會出現這種問題的,之所以出現這個問題絕大多數情況是由於伺服器的原因,為了安全才做了這樣的限制!

我的解決方案(比較直接):

  

路徑:/usr/local/nginx/conf/fastcgi.conf

    註釋掉:fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

  重啟nginx :service nginx restart