Common WordPress Errors and Fixes

WordPress is a complex piece of software and like any software, you may encounter an occasional error. This post will help you troubleshoot and fix the most common WordPress errors.

It is always a good idea to make regular backups of your WordPress installation. You do not want to lose all the hard work you have put into your site. You should investigate with your web host whether they make regular backups of your site and even if they do,  you may want to use a backup plugin to keep your own backups.

You shouldn’t worry that an error you are seeing is associated with a loss of data. Data loss is highly unlikely and I very rarely encounter it.  The most common problems are usually configuration errors or temporary errors with the computers running your WordPress site. If you have a managed WordPress hosting plan, the technical support included with your hosting plan should fix most of the common errors described below.

Fixing some WordPress errors requires FTP or SFTP access. You can learn how to connect to WordPress with FTP here.


500 internal server error

A 500 internal server error is a common error. It is a frustrating error because it does not provide any other information about the cause of the error. A 500 internal server error usually originates with the web server software running on the computer that hosts your site. This often means that some code executing to run your site is causing the error.

500 internal server error image

How to Fix a 500 internal server error:

  1. If you encounter a 500 internal server error and are unable to access your site and dashboard including logging in at your-domain-name.com/wp-admin, you should contact your web hosting provider for technical support. Provide them with the error and what you might have recently changed to cause the error.
  2. If you have access to your dashboard, the 500 internal server error may be caused by a corrupted .htaccess file. You can reset your .htaccess file by navigating to Settings –> Permalinks and then clicking the save button without changing any settings.
  3. If the 500 internal server error began appearing right after you added a new theme or plugin, remove the new theme or plugin. Try deactivating plugins one by one testing to see if the error stops. If you have FTP/SFTP access to your site and are comfortable using it you can delete plugins by deleting the directory named like the plugin from /wp-content/plugins/{name of plugin}. Similarly themes are located in /wp-content/themes/{name of theme}
  4. If none of the above fixes work, the core WordPress files may need to be reinstalled. You can download the latest version of WordPress at WordPress.org. You should not attempt to reinstall WordPress unless you are skilled technically or you may lose your data. You need to save a copy of wp-config.php from the root of your installation or the reinstall will not be able to access your WordPress database. Contact your web hosting provider or technical support.

Uploaded file exceeds the upload_max_filesize directive in php.ini

The error “uploaded file exceeds the upload_max_filesize directive in php.ini”  indicates the file you are trying to upload is too large based on current web server settings. This is likely not a WordPress setting or error but an error of the underlying PHP configuration of the server on which your blog is hosted. (WordPress is written in a programming language called PHP.  The computer on which your WordPress site is located executes the PHP code of WordPress to make your site run.)

How to fix the error: Uploaded file exceeds the upload_max_filesize directive in php.ini:

  1. If your WordPress site is hosted on an inexpensive shared server plan and you are trying to upload a very large theme, photograph or video file, you may actually be exceeding the limits allowed by your web host. Examine the properties of the file you are uploading. Is the file a large number of megabytes 50, 100, or more megabytes? If so you may be able to upload the file through FTP/SFTP access instead if you have the username and password from your hosting provider. Themes go in to wp-content/themes/ subdirectory. Images and video files can be uploaded to /wp-content/uploads/ and then a directory of the year, ex. 2019 and then the month, ex. “01” for January. Large video files should be uploaded to a video sharing account like Youtube or Vimeo and then embedded in your WordPress posts and pages instead of uploaded to your site.
  2. You can also try increasing php upload file size and memeory limit values in the .htaccess file in the root of your WordPress installation. Keep a backup of your .htaccess file and then add the following values at the end of  the .htaccess file:
    php_value upload_max_filesize 64M
    php_value memory_limit 256M
    php_value post_max_size 32M
    php_value max_execution_time 600
    php_value max_input_time 900
  3. Settings and increasing the above php values can also fix similar error messages:
    • exceeds the maximum upload size for this site
    • warning post content-length of bytes exceeds the limit
    • Fatal error: Allowed memory size of XXXXX bytes exhausted in …/wp-includes/XXXX.php on line XXX or similar
    • 413 Error: Request Entity Too Large
  4. If you have full root access to your server or VPS, you can also change these settings in the php.ini. Beware, multiple PHP versions may be installed on your server. Additionally making these changes without experience installing and configuring a Linux server is a bad idea.

Error message: Briefly unavailable for scheduled maintenance. Check back in a minute.

This error is a normal part of the WordPress update process. If you only encountered this error for short time and it resolved then it occurred because the WordPress core, a plugin, or theme was being updated at the same moment you tried to access the site.

How to fix the WordPress error, “briefly unavailable for scheduled maintenance. check back in a minute:

  1. If this error does not clear up after a few seconds to a minute and you have tried refreshing the page in your web browser, it could indicate that your WordPress site is stuck in maintenance mode.
  2. Very rarely WordPress may get stuck in maintenance mode due to a conflict or slow server response times during updates. When WordPress is stuck in maintenance mode you can usually fix it by deleting the .maintenance file from the root of your WordPress installation through FTP/SFTP. Learn how to connect for WordPress FTP access.
    wordpress fix maintenance mode error delete file
    If you do not have FTP/SFTP access to your site or are not comfortable with technical troubleshooting, you should contact your hosting provider for support.
  3. If no .maintenance file exits, locate the wp-activate.php in your root WordPress directory. Edit the wp-activate.php and change define( ‘WP_INSTALLING’, true ); to:
    define( 'WP_INSTALLING', false );

Remember to always make a backup of core WordPress files before you begin making changes.


Error: Sorry, you are not allowed to access this page

The error”sorry, you are not allowed to access this page” is a  permission or security issue. It can have several causes.

Common causes of the error “sorry, you are not allowed to access this page” include:

  • A theme, plugin or core file and the WordPress database do not match.
  • The username or password to your WordPress database is incorrect in wp-config.php.
  • There is a problem with the PHP interpreter or it may be out of date.

How to fix, sorry you are not allowed to access this page.

  1. With any error you encounter, ask yourself whether you made a recent change that might have triggered the error. If you made a recent change to files, plugins, password etc…, undo what you changed and that may fix the error.
  2. Turning on the WordPress error debugging may provide more information about this error. To turn on error debugging in WordPress edit the wp-config.php in the root of your WordPress installation and add the following if it is not already present:
    define('WP_DEBUG', true); 

    Enabling WP_DEBUG will cause more PHP error information to be shown. Search Google for answers to your specific error. Be sure to remove or set the WP_DEBUG setting to false once you are done troubleshooting the errors.

  3. This error may be caused by a file system permissions problem. The root files in your WordPress installation (NOT the directories wp-admin, wp-content, or wp-includes) should be set with numerical permission 644 in the properties or permission setting screen of your FTP/SFTP client. The directories wp-admin, wp-content, and wp-includes should be recursively set with a 755 permission.
  4. Since this error can be caused by database problems, you may want to try restoring the WordPress database if you have a recent backup. Restoring a backup of a WordPress database should only be done by a professional, usually your web host provider or outside technical support.
  5. Did you make any changes to wp-config.php or the database prefix, password or username set in wp-config.php at
    define('DB_USER', 'YOUR-USERNAME');
    define('DB_PASSWORD', 'YOUR-DATABASE-PASSWORD');

    (Note the username and password here are not the ones used to login to your WordPress dashboard. The username and password in wp-config.php are special entries used to communicate with the database that holds the content of your WordPress site.)  Compare these settings to a previously working backup file.

  6. It is also possible that is an error is occurring because your WordPress installation was hacked. Install and run a scan with a security plugin like Sucuri Scanner  or Wordfence

Error: WordPress too many redirects

If you are seeing an error of too many redirects when trying to access your website then there is a configuration problem. Your site may be redirected in a loop.

For example, a combination of your WordPress install, your .htaccess or a plugin is causing the non-www version of your site to redirect to the www version which then redirects back to the non-www site in an endless loop. After several rounds of redirects, your web browser will stop following the redirects and show an error message.

To fix a WordPress too many redirects error try the following:

  1. If you can access your Dashboard navigate to Settings –> General and change the site URL by adding or removing the www. prefix if it is not already there and then save changes. If you are unable to access your Dashboard or you can change this setting with FTP/SFTP by editing the file wp-config.php in the root of your WordPress install. Add or remove values with www. as appropriate to try to end the redirect loop:
    define(‘WP_HOME’,’http://YourSite.com’);
    define(‘WP_SITEURL’,’http://YourSite.com’);
    
  2. If you just installed or updated a plugin that may have caused the too many redirects error, disable that plugin. If you are unable to disable a plugin from the WordPress Dashboard, you can delete the directory with the name of the plugin from the /wp-content/plugins/  subdirectory to disable the plugin.
  3. A too many redirects error could also be caused by a bad redirect in your .htaccess file or at your CDN if you use a reverse proxy CDN like Cloudflare or Incapsula. Remove any redirects in the .htaccess in the root of your WordPress install or at your CDN and see if that resolves the error.
  4. If you are unable to resolve a too many redirects error you will need to contact your web hosting provider or a technical support person for assistance.

Error, your PHP installation appears to be missing the MySQL extension which is required by WordPress

When you see the message, error your PHP installation appears to be missing the MySQL extension which is required by WordPress, there is a configuration problem with PHP on the web server that hosts your website.

The core of WordPress is written in a programming language called PHP and a program on your web server runs the PHP code to make your site work. The PHP setup on the server that hosts your site needs an extra piece of the PHP program installed which allows it to communicate with the database where the content of your WordPress site is stored. This error indicates that the PHP install on your web server is missing that piece or extension which allows it to talk to the MySQL database program.

How to Fix WordPress Error PHP installation appears to be missing the MySQL extension:

You need to update or reinstall PHP on your web server making sure it includes the MySQL extension to fix this error. This is an error that your hosting provider should fix for you. Please contact your hosting provider for technical support.

If you are managing your own web server and want to attempt the repair yourself, you can find a comprehensive guide to installing PHP on a Ubuntu server here.


WordPress error establishing database connection

This error actually describes exactly what the problem is, WordPress cannot communicate with the database that contains the content of your site. Unfortunately, that doesn’t tell us why there is an error establishing a database connection.

This most likely causes of an error establishing a database connection are:

  • The database program or server is down and needs to be restarted
  • The database username, password or prefix are missing or incorrect in wp-config.php

How to fix WordPress error establishing database connection:

  1. If you have paid for managed WordPress hosting, the technical support for your web host should fix this error for you.
  2. If you are managing your own VPS or server, the wp-config.php file is located in the root of your WordPress install. Be sure to back up the file before making any changes. The best way to confirm the values in your wp-config.php file are correct is to go to your most recent backup from when your site was working and compare the backup file to the current values of
    define('DB_NAME', 'XXXXXX');
    define('DB_USER', 'XXXXXX');
    define('DB_PASSWORD', 'XXXXXXX')
    $table_prefix = 'wp_XXXXXXX_';
    
  3. If the values in your wp-config.php appear correct or you are unable to determine if they are correct, try restarting your database server. You will need SSH (shell access) to restart your database server if you are managing your own server. On an older Ubuntu or Debian server you can stop and restart MySQL with:
    sudo /etc/init.d/mysql stop
    sudo /etc/init.d/mysql start
    

    To stop and start MySQL on Ubuntu 15.04 and later use the following:

    sudo systemctl start mysql
    sudo systemctl stop mysql
    

    If an error occurs when restarting the MySQL database, you will need to investigate the error further. Check the MySQL database and system log files.

  4. If you have SSH access to your server, can you login to your MySQL database and see the database and tables for your WordPress install? Here is a tutorial to access MySQL and display the database and tables.

HTTP error when uploading images to WordPress

The error, “HTTP error when uploading images to WordPress” is often encountered when a web server is low on resources. Does the error reoccur with a smaller sized image file? Does the HTTP error still occur when uploading if you wait a few minutes and try again? You may contact your host to see if your site is exceeding its quota for your hosting plan.

Another cause of this error may be that the PHP memory limit is set too low.

Large WordPress image uploads can also fail on very slow DSL or poor wireless Internet connections.

How to Fix HTTP error when uploading images to WordPress:

  1. Wait a few minutes and see if the error resolves on its own. If it resolves but reoccurs often, investigate whether your website traffic or resources used is at or near the limit of your hosting plan or server resources.
  2. If your Internet connection is very slow, disconnecting or you have poor wireless reception in your current location, try again on a better Internet connection.
  3. Trying increasing the PHP memory limited by adding:
    define( 'WP_MEMORY_LIMIT', '256M' );

    to the wp-config.php file located in the root of your WordPress install. You will need FTP/SFTP access to perform that task.

  4. An HTTP error when uploading images may also be caused by the image editor library being used. PHP on which WordPress is based has two image libraries, ImageMagick and GD. WordPress usually uses ImageMagick. You can try switching to the GD library to fix this problem. To switch to the GD library add the following function to the bottom of your functions.php file located in the directory of your active theme. For example, in /wp-content/themes/{nameofyourtheme}/functions.php, add the following at the end of the file right before the closing ?> tag:
    function change_default_image_editor_to_gd( $imgeditors ) {
    $gdeditor = 'WP_Image_Editor_GD';
    $imgeditors = array_diff( $imgeditors, array( $gdeditor ) );
    array_unshift( $imgeditors, $gdeditor );
    return $imgeditors;
    }
    add_filter( 'wp_image_editors', 'change_default_image_editor_to_gd' );
    

    Depending on the configuration of WordPress used by your hosting provider, you may also be able to edit your functions.php through your WordPress Dashboard. Navigate to Appearance —-> Editor, then on right side list of “Theme Files” click on “Theme Functions (functions.php)” to edit the file. You can also perform this edit with FTP/SFTP access to your server.


Questions about other WordPress errors?

If you have a question or comment about one of the errors listed above, please leave a comment below.

If you have a question about an error NOT listed above, please ask it in our questions and answer section.

Leave a Comment