以前能正常運行,今天切換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就不能訪問。
將其註釋掉即可。