在contos系統(tǒng)下。使用的為thinkphp框架Apache/2.4.7 (Unix) PHP/5.5.10
安卓發(fā)起請求。
500 Internal Server Error 但是 數(shù)據(jù)卻正常返回
首先在/phpstudy/server/httpd/logs/error_log 文件中 查看錯誤詳情
錯誤很長截取了重要部分
PHP Fatal error: Uncaught exception 'think\\exception\\ErrorException' with message 'error_log(/phpstudy/www/SwmSignPhp/runtime/log/201710/11.log):
failed to open stream: Permission denied' in /phpstudy/www/SwmSignPhp/thinkphp/library/think/log/driver/File.php:116\nStack trace:\n#0 [internal function]:
大致意思為,PHP致命錯誤:沒有權(quán)限在ThinkPHP框架中,寫入log日志。
/phpstudy/www/xxx項(xiàng)目名/runtime/log/201710/11.log)
使用 WinSCP 查看相應(yīng)目錄下后面的權(quán)限

缺少寫入權(quán)限.png
知道了問題根源,我們就來修改吧。
Linux添加目錄權(quán)限命令:
chmod o+w /phpstudy/www/xxx項(xiàng)目名/runtime
即可正常。權(quán)限參考CentOS下查看以及修改文件權(quán)限