Laravel.log File Write issues
after the project
root is deployed to the server using an account, Access returns a 500 error.
After the problem occurs, first look for the problem as follows:
View Nginx error Log
View PHP error logs
Code break point test to access
The trace is not found in the error log, and the 500 error is usually caused by a code error, confirming that the debug feature of Laravel is turned on:
# view. envapp_debug=true
An error message appears on the Post-Setup page: Log file has no permission to write. This is because the owner of the log file, the user group root , and the default is 755, causing non- root users to write.
View Writers
Execute the following command to view the owner of the PHP-FPM:
Ps-ef | grep php-fpm
Return information:
Apache 9520 11965 0 May25? 00:02:11 php-fpm:pool wwwapache 10437 11965 0 May26? 00:02:10 php-fpm:pool wwwroot 11965 1 0 May20? 00:07:35 Php-fpm:master Process (/etc/php-fpm.conf)
The first column is the execution user of PHP-FPM.
Set log Permissions
Confirm permissions for the log directory
Ls-l storage/
Drwxr-xr-x 3 root root 4096 Jul 18:17 appdrwxr-xr-x 6 root root 4096 Jul 10:58 frameworkdrwxr-xr-x 2 root root 4096 Jul 16:17 Logs
Here you can find the file owner as root, and PHP as other users only read and execute permissions, no write permission.
Modify file Permissions
#-R refers to the recursive modification of the folder and all content under this folder # my PHP is User Apache, please refer to your situation modify Chown Apache Storage/logs-r
The framework folder also has permission to write, and the cache generated by the views layer is in it and can be modified at the same time
Chown Apache Storage/framework-r
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!