thinkphp5 項目筆記

1、解決500錯誤(index.php首頁爲空白頁面
(1)
在index.php開頭,打開報錯,如下
error_reporting(E_ALL);
ini_set('display_errors', '1');
(2)
打開nginx配置的錯誤日誌


2、問題:
Warning: require(): open_basedir restriction in effect. File(/home/stone/dsales/src_web/v1r0/simplewind/thinkphp/base.php) is not within the allowed path(s): (/home/stone/dsales/src_web/v1r0/public/:/tmp/:/proc/) in /home/stone/dsales/src_web/v1r0/public/index.php on line 38
解決
(1)檢查php.ini的 open_basedir的參數
(2)如果是lnmp(nginx服務器),檢查 path/nginx/conf/fastcgi.conf裏的 $document_root參數
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/stone/dsales/"; (/home/stone/dsales/爲項目路徑)
注意:如果在fastcgi.conf裏沒有 fastcgi_param PHP_ADMIN_VALUE……自行添加


3、問題
session驅動使用redis時,出現:
session_start(): Failed to initialize storage module: user (path: )

解決(1):在php.ini中 把
session.save_handler = files
修改爲
session.save_handler = user
(這個好像不用改)

解決(2):
在TP5中,因爲要用到redis,所以會在…path\simplewind\thinkphp\library\think\session\driver\Redis.php 75行調用到php的擴展函數(new \Redis)->close(),所以如果發現項目加載奇慢,要考慮到是否開啓或加載了php-redis函數擴展庫(注意:不是redis,而是php-redis擴展,可用phpinfo查看)

4、TP框架本身自己封的方法dump有點問題,不能打印加密過的東西,如 openssl_sign;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章