How to troubleshoot problems with Laravel.log file writes

Source: Internet
Author: User

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:

    1. View Nginx error Log

    2. View PHP error logs

    3. 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.