Home > Docs > Product Import Export Plugin for WooCommerce > Finding PHP Error Logs of WordPress/ WooCommerce sites

Finding PHP Error Logs of WordPress/ WooCommerce sites

Last updated on June 27, 2022

Is the Import export operation not working as expected? The Logs section gives you a detailed history of everything that has been happening in the heart of an import-export operation. So, if anything goes wrong, they give a useful overview of the events in order to help you, the developer, seek out the culprits.

We can access the PHP error logs through:

1. WooCommerce logs

2. PHP logs

WooCommerce Logs

WooCommerce introduced a log that displays PHP fatal errors. This log can contain information that would otherwise be contained in PHP error logs. It’s a good place to start before looking for PHP logs on the server.

How to reach WooCommerce logs?

To access the WooCommerce Fatal Errors log:

  1. Go to WooCommerce > Status > Logs
  2. Choose a log from the drop-down labeled fatal-errors.log
  3. Click View
A sample view of WooCommerce Fatal Errors Log

The types of errors caught in this log are:

  • PHP fatal errors
  • Runtime errors
  • Errors purposely triggered in the code by a PHP function. 

Fatal errors occur when the action in the code cannot be completed. Examples of a fatal error include:

  • Calling an undefined function
  • Using an undefined variable
  • Calling a function on a null or otherwise unusable variable

The log will include the:

  • Timestamp when the error occurred
  • Error that occurred
  • File and line in the code for the origination of the error
  • Stack trace: a snapshot of the history of the function calls and files leading up to the error

PHP logs

The PHP error logs can be useful when investigating an issue with a site. These may vary depending on the OS platforms(Cent OS, Linux).

How to reach PHP logs?

You can find the PHP error logs in a few possible places on the server:

  • in your server’s root folder, called error.log
  • in public_html or similar folder, called error.log
  • in var/logs or similar, called error.log
  • Additionally, if you have debugging enabled in WordPress and you have it saved to a file, it will be in the wp-content folder, and called debug.log

Finding with PHP

If you can’t find the file, you can have PHP tell you where it is:

  1. In the root of your WordPress’s directory, create a file named phpinfo.php . 
  2. Open the phpinfo.php file in a text editor.
  3. Insert <?php phpinfo(); ?> into the file.
  4. Open the file on your site. For example, if your site’s URL is example.com, you can open the file by visiting http://example.com/phpinfo.php
  5. Search the page for the error_log value. 
  6. The file path listed here is the absolute file path of the PHP error log. Visit that address on your server to find the PHP error log. 
  7. If the value is empty, you must set a value to log errors on your site.
Output of phpinfo

Any other strange behaviours?

WordPress 502 Bad Gateway Error

This error can break your website and consume hours of troubleshooting. When the server fails to respond accurately and returns the request with some invalid information, we get the error: “502 Bad Gateway”. This error can occur if:

  • Your server is busy with other tasks or is experiencing high traffic from a specific website (in case of shared hosting).
  • The origin servers are not responding or are inaccessible.
  • Errors in the database.
  • There is an issue with the reverse proxy server.
  • Corrupt PHP scripts in files such as WordPress themes and plugins.
  • CDN is acting up
  • DNS issues
View of bad gateway error in Network tab

Learn how to Fix 502 Bad Gateway Error.

Broken database tables

Broken database tables can stop the import-export operations from working correctly.

  1. Try restoring the database tables from a backup, or deleting the plugin database tables and reinstalling the plugin(In this action, you may lose all of the data associated with your previous imports).
  2. Deactivate and reactivate the plugin.
  3. Test on a fresh WordPress installation with a newly created MySQL database.

Refer other troubleshoot articles by WebToffee :

If the problem persists, contact WebToffee support for assistance.