宝塔面板因为open_basedir引起的No input file specified问题,No input file specified解决方法

2020-01-03
0评论
/
1366阅读
爱搜啊

宝塔面板因为open_basedir引起的No input file specified问题,No input file specified解决方法

本站服务器配置

阿里云学生主机,Centos 7.2 64位,安装了宝塔面板5.8.7,nginx1.12+php5.6+mysql5.5

遇到No input file specified问题

做了一个下载网站,使用阿里云CDN进行下载加速。
自己的服务器上有两个站点,主站A和CDN回源站点B
主站A在服务器上的web根目录为/www/wwwroot/A/
回源站点B的web根目录为/www/wwwroot/B/

主站A使用php5开发,当有文件上传时,经过安全验证的文件要移动到站点B的data目录中。
使用php中的函数move_uploaded_file()移动上传的文件到B/data/目录中时报错,信息如下:

move_uploaded_file(): open_basedir restriction in effect. File(/www/wwwroot/B/data/xxxxxxxx.txt) is not within the allowed path(s): (/www/wwwroot/A/:/tmp/:/proc/)

解决方法

将/www/wwwroot/B/data/添加到站点A的open_basedir设置中即可。
无奈不知道open_basedir在哪里设置的

执行grep -r "open_basedir" /etc/ 搜索无果
又执行grep -r "open_basedir" /www/

查找到的部分内容如下:

/www/wwwroot/A/.user.ini:open_basedir=/www/wwwroot/A/:/tmp/:/proc//www/wwwroot/B/.user.ini:open_basedir=/www/wwwroot/B/:/tmp/:/proc/

原来配置文件是隐藏文件.user.ini
打开A的.user.ini
改成 user.ini:open_basedir=/www/wwwroot/A/:/tmp/:/proc/:/www/wwwroot/B/data/
保存,重启nginx。

No input file specified解决方法

除`fastcgi_params`可以设置`doc_root`外,php.ini里面还可以配置`doc_root`,他会把你`fastcgi.conf`里面的`$document_root`参数覆盖掉,所以在php.ini中确保`doc_root`是空的,你这个问题应该是`fastcgi.conf`里面的open_basedir里面指向的路径不对。
你可以在站点配置文件里面加上`open_basedir`试试
`open_basedir=yourpath:/tmp/:/proc/`


本站附件分享,如果附件失效,可以去找找看

诚通网盘附件百度网盘附件


于2020-01-03发布