You can locate and view the error logs generated by your website's PHP scripts to identify the cause of malfunctions, such as "White Screen of Death" errors or specific PHP warnings. This process allows you to see the exact file path and line number where an error occurred.
Before you begin
You will need:
Access to your website's control panel (such as cPanel or Windows Control Panel).
File Manager or FTP access to your website's files.
Locate the PHP error log
Depending on your server configuration, PHP errors may be logged in different locations. Check the following locations to find the relevant log file.
Checking the local directory
Most modern configurations log errors to a file within the directory where the script is running.
Log in to your control panel and open the File Manager.
Navigate to the directory where your website's files are located (typically
public_htmlor a specific folder for your domain).Look for a file named
error_log.If multiple
error_logfiles exist, look for the one located in the specific folder where the error is occurring.
Checking the server-wide log
If a local error_log file is not found, the errors may be recorded in a central system log.
In your control panel, locate the Errors or Logs icon (the specific location may vary based on your hosting environment).
Look for a file named
php_errors.logorerror_log.If you are using a specific application like WordPress, check the
wp-contentorwp-adminfolders for a specific log file.
Reading the log
Once you have located the error_log file, you can view its contents to diagnose the issue.
In the File Manager, right-click the
error_logfile and select Edit or View.Scroll to the bottom of the file to see the most recent entries.
Look for lines containing "Fatal error," "Parse error," or "Warning."
Note: A typical error entry will include the date, the specific error message, the file path, and the line number. For example: [2023-10-27 10:00:00] PHP Fatal error: Uncaught Error: Call to undefined function... in /home/user/public_html/wp-content/plugins/plugin-name/file.php:124
If you cannot find an error log
If you cannot find an error_log file or the file is empty, the system may not be configured to log errors to a local file.
Enable PHP Error Logging: You can enable logging by creating or editing a
php.inior.user.inifile in your website's root directory. Add the following line:log_errors = OnCheck for specific application logs: If you are using a CMS like WordPress, check the
wp-config.phpfile to see ifWP_DEBUGis enabled, which may output errors directly to the screen or a specific log.
Limitations
The specific name and location of the error log file can vary depending on your server's configuration, the version of PHP you are running, and the specific software (such as WordPress or Magento) powering your site. If you cannot locate a log after checking the common locations, contact Hostek support for assistance in identifying the specific path for your account.
