require(): open

mac2026-09-25  8

添加.user.ini配置文件 在项目目录下添加 .user.ini 就是配置文件中 root /home/wwwroot/yii.test.cn/basic/web 指向的文件夹server { listen 8002; #listen [::]:80; server_name yii.test.cn _; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/yii.test.cn/basic/web; …… 编辑.user.ini的内容为:open_basedir=/home/wwwroot/yii.test.cn/:/tmp/:/proc/ 保存后记得 service php-fpm restart ,因为这个会有缓存,就是下面的cache_ttl 可在phpinfo 里面查看是否有效无效? 来检查下配置文件: 查看php.ini 配置文件是否开启 在php.ini 文件中查找 user_ini 将前面的分号删除 重启PHP,再去看看是否生效。???还是没用,来终极杀招—> 不就是因为fastcgi.conf 里面的 fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 动态获取的嘛 cp 一份,名字自定义。下面会使用到 改为固定值 fastcgi_param PHP_ADMIN_VALUE "open_basedir=/home/wwwroot/yii.test.cn/:/tmp/:/proc/"; 再cp一份enable-php.conf 名字自定义 把include fastcgi.conf; 改为 include fastcgi_yii.conf; 去编辑项目的配置include enable-php.conf; 替换为: include enable-php_yii.conf; 重启,完事!

最后说下为啥要大费周折的去复制文件。因为我的服务器不止跑一个项目,如果直接修改fastcgi.conf会影响到其他项目的正常运行。如果有更好的方法,欢迎评论

最新回复(0)