Error-Log
When running PHP scripts on your server, errors can occur. To understand and resolve these, the PHP error.log is a valuable resource. This file logs all error messages and warnings that occur during the execution of your PHP scripts. Here’s how to find the error.log and what you can do with it.
What is the PHP error.log?
The PHP error.log is a log file that collects all PHP errors and warnings that occur while your code is running. It helps you pinpoint exactly where issues in your code lie, allowing you to quickly fix them.
How do I find the PHP error.log?
The error.log file is typically located on your web server and can be accessed via FTP or the control panel of your hosting provider. At Hoststar, you can access the error.log through your FTP account.
Common PHP error messages in the error.log
Parse Error: Syntax Error
Meaning: There is a syntax error in the PHP code, such as a missing semicolon or an unclosed bracket.
Example: Parse error: syntax error, unexpected 'echo' (T_ECHO) in /path/to/file.php on line 10
Solution: Check the line indicated in the error message and fix the syntax error.
Fatal Error: Maximum Execution Time Exceeded
Meaning: The PHP script has exceeded the maximum allowed execution time.
Example: Fatal error: Maximum execution time of 30 seconds exceeded in /path/to/file.php
Solution: Optimize the script to reduce execution time, or increase the maximum execution time in the PHP configuration.