很久没有做PHP相关的事情,这几天运行PHP的服务器遭受到Dos攻击,导致服务器不得不关闭80端口,而之前由于地址被写入到二维码中,又不能不让http来访问,于是只好更换服务器了,结果安装完后老是运行不起来,页面出现 No input file specified.
php运行提示Unknown: open_basedir restriction in effect
1、运行的页面显示为报错,但是文件是正确存在且没有问题的:
No input file specified.
2、查看日志 error.log中报错为:
FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/www/wwwroot/**/index.php) is not within the allowed path(s): (/www/wwwroot//:/tmp/:/proc/) in Unknown on line 0
PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
原来是 php.ini 上面的配置 open_basedir 选项没有配置。开启open_basedir并设置为
open_basedir = /var/www/
/var/www/ 为网站存放的目录,保存后,重启下php和nginx,程序正常运行了。