php错误500 ;End of script output before headers: index.php

以前能正常运行,今天切换php版本遇到下面的问题:

[Sun Apr 19 11:04:52.224694 2020] [core:notice] [pid 9164:tid 392] AH00094: Command line: 'E:\\WebSite\\PHP\\phpStudy2016\\Apache\\bin\\httpd.exe -d E:/WebSite/PHP/phpStudy2016/Apache'
[Sun Apr 19 11:04:52.234694 2020] [mpm_winnt:notice] [pid 9164:tid 392] AH00418: Parent: Created child process 8616
[Sun Apr 19 11:04:53.778782 2020] [mpm_winnt:notice] [pid 8616:tid 408] AH00354: Child: Starting 150 worker threads.
[Sun Apr 19 11:04:56.417933 2020] [core:error] [pid 8616:tid 1880] [client 127.0.0.1:50410] End of script output before headers: index.php

 

参照:https://www.zhaokeli.com/article/8547.html 无效

参考:https://segmentfault.com/q/1010000014298584/a-1020000017977891

php.ini里面注释小对应插件,还是有问题:

切换其他版本php倒是能正常执行,应该是配置问题了

配置 php.ini
error_reporting = E_ALL
log_errors = On
error_log = php_errors.log

 

刷新页面后打开php_errors.log:

[19-Apr-2020 11:52:04 Asia/Shanghai] PHP Warning:  Unknown: open_basedir restriction in effect. File(\www\app\index.php) is not within the allowed path(s): (C:/Windows/Temp/;C:/Temp/;E:/WebSite/PHP/temp/session/) in Unknown on line 0
[19-Apr-2020 11:52:04 Asia/Shanghai] PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0

原来是不记得什么时候配置了open_basedir,

这个是用来限制php的目录访问权限什么的,如果不在允许的范围内,php就不能访问。

将其注释掉即可。

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