How to Troubleshoot WordPress with WP Engine Error Log

How to Troubleshoot WordPress with WP Engine Error Log

The WP Engine error log provides you a detailed trace of how different areas of your site’s code interacts with itself, WP Engine server, and WordPress core. In this article we’ll show you actual error logs and provide explanations on How to Troubleshoot WordPress with WP Engine Error Log.

Before we jump into each log here’s a quick summary of them and their severity.

Log Name Summary Severity
curl_exec External API call that takes more than 500ms. Medium
File Permissions PHP Warning showing file permissions that are incorrect. Medium
Killed Query Query that is over 16,000 characters. High
Long Query Query that is over 1,024 characters. Medium
NGINX Profile Added Caching exemption added. Not an error. Low
PHP Fatal Error An unrecoverable critical function error. Execution terminated. High
PHP Notice Non-critical error caused by undefined variable or index. Low
PHP Parsing Error Code is incorrect and could not be ran. Function was never executed. Medium
PHP Warning A recoverable critical function error. Execution was not terminated. Medium
session_start Session that is started new or resumed. Medium
WordPress Database Error Long or numerous MySQL queries being executed. High

 

[WPE Monitoring] Function.Curl_exec:




Default PHP Function we’ve added to the error log to show which external API calls are exceeding 500ms; which will add to the total load time of a site. This log is intended only for our platform to read and is not intended for humans to read. We use this log to help monitor, evaluate, and optimize sites on our platform.

Examples:


[Mon Jul 14 02:57:21 2014] [error] [client 127.0.0.1] [WPE Monitoring] Stopwatch php.pod-1007.function.curl_exec.duration exceeded 500ms. Was: 1241ms


 

File Permissions:

 

A permissions error in the error log is a PHP warning. You’ll see this error if a file is trying to be called and the permissions are incorrect. For example, if you uploaded content via SFTP and never reset file permissions via your wp-admin dashboard — both the permissions and the owner/group will be incorrect which will lead to the permission error. You’ll also want to check to ensure the file getting the error actually exists.

Examples:


PHP Warning: file_put_contents(/nas/wp/www/cluster-1234/yourblog/wp-content/themes/badperms/lib/css/theme.css) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /nas/wp/www/cluster-1242/yourblog/wp-content/themes/WFTDAtv/lib/less/lessc.inc.php on line 1418...


[Sat Oct 20 22:38:24 2012] [error] [client 127.0.0.1] PHP Warning: file_put_contents(/nas/wp/www/cluster-1374/yourblog/wp-content/themes/yoo_phoenix_wp/cache/xml-80a72b04a693554d055946d5ad954588.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /nas/wp/www/cluster-1374/yourblog/wp-content/themes/yoo_phoenix_wp/warp/helpers/xml.php on line 37, referer: http://yourblog.wpengine.com/wp-admin/customize.php


You could also see an error like this if a plugin or theme is trying to do something that’s not allowed on our platform or is trying to access a file/directory it shouldn’t have access to:
PHP Warning:  file_put_contents(/nas/wp/www/cluster-2349/yourblog/wp-content/cache/autoptimize/autoptimize_b1b3a88cd5d8cfd4d1b5a716beef375a.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /nas/wp/www/common/production/php_prevent_flock.php on line 21...


 

[Error] KILL QUERY:

 

Used to determine which queries of SELECT Statements have been killed and not executed by WP Engine due to the query length being over 16k characters; which is inefficient and should not be ran on a production database.

Example:


[Wed Mar 26 06:26:19 2014] [error] [client 127.0.0.1] KILLED QUERY: SELECT DISTINCT `user`.`ID` AS user_id, t.* FROM …





We have included it in the log to identify a query that was killed and not executed by WP Engine due to the length of the query being over 16k characters, which is inefficient and should not be run on a production database. These only apply to Select statements, and not any other type of statements. If these queries need to be run, they should be done so on a local copy of the database that can be downloaded from any backup point in the User Portal. This can be resource intensive; which is why we’ve provided this log.

[Error] LONG QUERY:

Used to determine which queries of SELECT Statements could be optimized due to the character limit being over 1,024.

Example:


[Wed Mar 26 06:26:19 2014] [error] [client 127.0.0.1] LONG QUERY: SELECT DISTINCT `user`.`ID` AS user_id, t.* FROM


We have included it in the log to signify that the length of the query, which would be over 1,024 characters, is a Long Query and may be able to be optimized. We did not take any action on this query, it is just a notice to our customers. These only apply to Select statements, and not any other type of statements.

NGINX Profile Added WooCommerce:

 

WPE API [success]: woocommerce Nginx Profile Added – This isn’t actually an “error”. With WooCommerce, there are certain caching exemptions that need to be put in place in order for it to function properly. What this is saying is that the nginx profile that contains the necessary cache exemptions has been successfully added to the installation, meaning that the cart and account functions will work as they should.

Example:


[Wed Mar 26 06:26:19 2014] [error] [client 127.0.0.1] WPE API [success]: woocommerce Nginx Profile Added


 

PHP Fatal Error:

 

This is a critical error that can’t be recovered from, such as calling a function that doesn’t exist or there’s not enough memory that’s able to be allocated to the script. If you see a fatal error, it means that the execution of the script was terminated. You can see from the error what plugin/theme/script is causing the issue and in most cases you should be contacting the developer first.

That being said, a common troubleshooting step from our end is increasing the memory allocated to PHP. However, this doesn’t always do the trick, which is why contacting your developer is beneficial. Below you’ll find a function, memory, and script fatal error:

Examples:


PHP Fatal error: Call to undefined function get_current_screen() in /nas/wp/www/cluster-1234/yourblog/wp-content/plugins/leads/modules/wpl.m.post-type.wp-lead.php on line 191, referer: http://yourblog.wpengine.com/wp-admin/


PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 3232498752423 bytes) in /nas/wp/www/cluster-1234/yourblog/wp-includes/taxonomy.php on line 3314, referer:...


PHP Fatal error:  main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;RealScoutColorScheme&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in /nas/wp/www/cluster-1234/yourblog/wp-content/themes/navigator/style.php on line 18, referer: http://yourblog.com/wp-admin/...


 

PHP Notice:

 

These indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. It’s a non-critical error that’s usually caused by an undefined variable or index, so the script is still doing something wrong but the error isn’t serious enough to cause the script to be terminated. These errors should still be addressed as they may be indicative of a bug that may cause problems in the future.

Again, the best course of action is to contact your developer or if it’s specific to a theme/plugin, contact the developer of whatever is throwing the error.

Examples:


PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in /nas/wp/www/cluster-1234/yourblog/wp-includes/plugin.php on line 470...


PHP Notice: wp_specialchars is <strong>deprecated</strong> since version 2.8! Use esc_html() instead. in /nas/wp/www/cluster-1234/yourblog/wp-includes/functions.php on line 2908...


 

PHP Parsing Error:

 

This is similar to a fatal error, but a big difference between the two is the parse error will occur before the script is actually executed. What this means is that syntax of the code is incorrect and it’s not able to be compiled. This will point to an issue with the code. It could be a missing character or an unexpected (unneeded) character/symbol that’s causing it, but you’ll be able to tell exactly which line on which file is troublesome from the output of the error. This will usually be a job for your developer or the developer of your theme or plugin.

Example:


PHP Parse error:  syntax error, unexpected ')' in /nas/wp/www/cluster-1234/yourblog/wp-content/themes/badtheme/functions.php on line 18


 

PHP Warning:

 

Similar to a PHP Fatal Error the Warning error shows a script that is malfunctioning, but PHP was able to recover from and the script was not terminated. Not as serious as a fatal error, but these errors still need to be addressed because they could lead to more serious issues in the future. Just like the fatal error, you’ll want to contact the theme or plugin developer, as in the case of these examples:

Examples:


PHP Warning: DOMDocument::loadHTML() [<a href='domdocument.loadhtml'>domdocument.loadhtml</a>]: error parsing attribute name in Entity, line: 1 in /nas/wp/www/cluster-1234/yourblog/wp-content/plugins/conversations/class/frontend-form-post.php on line 296, referer: http://yourblog.wpengine.com/page/breaking-stuff/...


PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /nas/wp/www/cluster-1234/yourblog/wp-content/plugins/hyper-cache/cache.php on line 253, referer: http://warningsandstuff.com/...





PHP Warning: include() [function.include]: Failed opening '/nas/wp/www/cluster-1234/yourblog/wp-content/advanced-cache.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /nas/wp/www/cluster-1234/yourblog/wp-settings.php on line 65...
In the above case there’s nothing to fear. It’s just due to the WordPress core trying to get that advanced cache file, but it’s not included with our installations due to our own proprietary caching mechanisms. This specific error can be ignored


 

[WPE Monitoring] Function.Session_start:

 

Default PHP Function we’ve added to the error log to determine when sessions are resumed or opened; which is identified by either a GET, POST, or cookie. Session data is saved in a serialized format which PHP retrieves and unserializes in order to populate $_SESSION. This log is intended only for our platform to read and is not intended for humans to read. We use this log to help monitor, evaluate, and optimize sites on our platform.


[Mon Jul 14 20:11:29 2014] [error] [client 127.0.0.1] [WPE Monitoring] Stopwatch php.pod-1007.function.session_start.duration exceeded 200ms. Was: 749ms


 

WordPress Database Error:

 

You’ll see these errors when MySQL is overloaded. Typically, this is due to too many queries being run by multiple users or too many long queries being run. In a case like this, the error will point you to the offending plugin/theme/script, at which point you’ll want to ensure that the plugin or theme is completely up to date. If updating doesn’t resolve the issue, you’ll want to contact the developer to see about ensuring that queries don’t run too frequently or aren’t too inefficient. Sometimes enabling object caching can help as well, as hopefully the queries could then be cached.

You can also get a database error if the syntax of a query is bad, like trying to query a table that doesn’t exist. When that happens, you will want to get in contact with your developer or the developer of the plugin/theme (if the error is specific to a plugin or theme) to ensure that the queries being generated have good syntax.

Examples:


[Sun Jun 23 00:01:04 2013] [error] [client 127.0.0.1] WordPress database error Lost connection to MySQL server during query for query...


[Sun Jun 23 00:01:04 2013] [error] [client 127.0.0.1] WordPress database error MySQL server has gone away for query SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (789) ORDER BY t.name ASC /* From [www.yourblog.com/2011/01/22/this-page-breaks-the-database/] in [/nas/wp/www/cluster-1234/yourblog/wp-content/plugins/seo-image/seo-friendly images.php:174] */ made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/freshlife/single.php'), the_content, apply_filters('the_content'), call_user_func_array, seo_friendly_images, preg_replace_callback, seo_friendly_images_process, get_the_tags, get_the_terms, wp_get_object_terms


WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 0, 5 /* From [yourblog.com/?s=crossknowledge] in [/nas/wp/www/cluster-' at line 1 for query SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND (((wp_posts.post_title LIKE '%')))  AND (wp_posts.post_password = '')  AND wp_posts.post_type IN ('post', 'page') AND (wp_posts.post_status = 'publish')  ORDER BY FIELD(wp_posts.ID, ) LIMIT 0, 5 /* From [yourblog.com/?s=crossknowledge] in [/nas/wp/www/cluster-1234/yourblog/index.php:17] */ made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, referer:...'

Source:WP Engine Support

Tagged with:

Leave a Reply