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;

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