Common PHP WordPress Errors and how to solve them

PHP errors tend to be a common issue for users that are on older servers, this tends to be an issue with lower quality hosting providers. The following errors may occur when activating your new theme, adding plugins or uploading content to WordPress. The following tutorial covers the most common PHP WordPress errors and how to solve them.

WordPress Memory Exhausted Error – Increase PHP Memory

This is a common error with WordPress and shared hosting plans. It’s a memory issue with uploading files to WordPress. If you’re uploading large files such as plugins, themes or unoptimized images this may occur. This error may cause a white screen of death, or a message like this:

Fatal error: Allowed memory size of 33565589 bytes exhausted (tried to allocate 2343219 bytes) in /home/username/public_html/sitename/wp-includes/plugin.php on line xxx

Check out the following fix from our good friends WP Beginner on how to solve this issue here.

Installed theme Syntax Error

The same error may occur when adding a new theme to the site (this happens with our newer themes on older PHP versions), you’ll get the similar message as above.

Parse error: syntax error, unexpected T_STRING in/public_html/sitename/wp-content/themes/themename/functions.php on line 27

In this instance, you should contact your hosting provider, or refer to your hosting documentation. It may be a simple case of updating your PHP version to version 5.4 or higher.

See how to update PHP from popular providers, we recommend PHP 5.6 as the most stable version, PHP 7.0 will also work, you may still find issues with PHP 7.1, NOTE! be sure to make a backup of your site before upgrading:

Update GoDaddy PHP Version

Update SiteGround PHP Version

Update Bluehost PHP Version

Update 123Reg PHP Version

We highly recommend choosing a hosting provider that uses the most up to date servers. This will greatly improve your site’s performance and user experience, which in turn can benefit your business. Check out our recommended hosting providers here. (Our favourite pick is SiteGround’s GrowBig package).

Syntax Errors WordPress when Adding Code

This error usually occurs when you’ve been adding some snippets on your to modify some files, maybe even you’ve just added a plugin that has an incompatibility issue. Most likely you’ve accidentally missed something or the code has incorrect syntax. This will result in a PHP parse error and you will see a message like this:

Parse error- syntax error, unexpected $end in /public_html/sitename/wp-content/themes/themename/functions.php on line 356

See the following tutorial on how to fix this syntax error.