Wednesday, February 28, 2018

Fix 11 Common WordPress Errors Without Paying a Penny In 2018!

Fix 11 Common WordPress Errors Without Paying a Penny In 2018!

Link to My Blogger Tricks

Fix 11 Common WordPress Errors Without Paying a Penny In 2018!

Posted: 28 Feb 2018 07:01 AM PST

Wordpress errors could become a headache or a nightmare for a webmaster who may not be well versed with handling PHP errors or MySQL database errors. Thankfully WordPress community has matured so much since 2003 that today there is an answer for almost every problem faced by a WordPress user.

Fix Common WordPress Errors Without Paying a Penny

WordPress is used by more than 29.9% of the top 10 million websites as of February 2018. It is the most popular content management system with a market share of 60.2% while Google blogger has a market share of just 2% (We play a part in that share too!).

Our site (MBT) is hosted on blogger and we have not yet migrated to Wordpress for several reasons. Security, WP errors and hosting expenses are amongst the biggest reasons why we have not yet moved.

However we have four other sites which are hosted on WordPress and we enjoy using WP a lot. In this tutorial I will share 11 Common WordPress errors that we often face and their easy solutions as applicable in 2018.

After following this tutorial thoroughly, you will surely acquire enough skills to troubleshoot your WordPress blog without paying a penny to a developer. You can surely buy me a coffee with your savings if you wish to! ;)

1. Common WordPress Database Errors

Your entire wordpress posts, comments and pages data is stored inside MySQL database, which is an open source relational database management system.  Wordpress updates, adds, removes or deletes data from these databases by performing structured query language commands using PHP.

Every Web host provides a friendly user interface called phpMyAdmin using which you can easily solve the following database errors:

Cannot Create/Write to File

This error occurs when:

  • MySQL cannot create a temporary file

You can easily fix this problem by changing the tmpdlr variable to point to a writable directory. Follow these steps:

  1. Log into your CPanel and head to phpMyAdmin
  2. In the search box find the my.cnf file. On *nix systems this is usually in /etc/. Open it in a simple text editor and find the [mysqld] section.
  3. Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Change it to  /tmp
  4. Save the file.
  5. Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
  6. Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld
  • The file permissions are incorrect

Every file has certain read/write/execute permissions grouped as:

  • Read 4 - Allowed to read files
  • Write 2 - Allowed to write/modify files
  • eXecute1 - Read/write/delete/modify/directory

You can easily edit the file permissions on your wp-content directory using an FTP client. I highly recommend you read the following tutorial by Wordpress to understand this problem in detail.

Unknown Column

There are two possible reasons why you are seeing this error. Either you are using incorrect quotation marks for the identifier quote character while running a database query or Wordpress Core update is not installed properly.

For the first reason I reason you go through the MySQL documentation to see what went wrong on your side.

For the second reason I recommend manually upgrading WordPress again by using a FTP client. Follow these steps:

  1. Get the latest WordPress zip  and extract the files.
  2. Deactivate all your WP plugins.
  3. Delete the old wp-includes and wp-admin directories on your web host using FileZilla
  4. Upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
  5. You must NOT delete your existing wp-content folder.
  6. Upload all files from the new wp-content folder to your existing wp-content folder, replacing existing files. Leave other files untouched.
  7. Upload all files from the root directory of the latest wordpress folder to your existing wordpress root directory.

That's it! If you have successfully replaced all files correctly then your site will be up in no time. If you get into a problem, do not panic and head straight to Google as there are tons of guides on stackoverflow and WP community forum.

These methods really empowers you to understand the core structure of WordPress and solve almost any error encountered in future. Master this skill and you can easily troubleshoot all WP errors!

2. Fix WordPress Error "Connection Timed Out"

When you put more load on your website than your server can actually cover, you are inviting this error. Since shared hosting have limited bandwidth and some webhosts like siteground provide only a limit of 25,000 pageviews a month, its common you may face this error during high traffic spikes or too much media being browsed. Such wordpress errors will be more commonly seen in 2018 as web hosting costs continue rising.

Following are few things you can try to resolve this error:

  • Deactivate all your WP Plugins. Reactivate them one-by-one to see which plugin is causing the problem. If deactivating all plugins did not resolve the problem then this error is not caused by a plugin.
  • Switch to a default WordPress Theme.  Switch to any default Twenty Sixteen WP theme to see if it is a theme problem.
  • Ask web host to increase maximum execution time in your php.ini file
  • Ask your webhost to increase memory limit .The memory limit in wp-config.php file is increased by your web hosting company.

These three things will hopefully resolve this error easily.

3. Fix Error WordPress "Establishing Database Connection"

You see this error when your server can not connect to your database. There are several reasons which could cause this. In my case following are the main culprits:

Incorrect wp-config.php Information

Using FilezillaoOpen up wp-config.php file and double check if the following details are correctly inserted:

  • Database name
  • Database password
  • Database host
  • Database username

All these credential details must match with those set  by you.

Compromised Website

I saw this error twice in 2017 when someone had compromised my site through a PHP contact form and got full control of the index.html page. In other words, you could see a database connection error when your site is h***ked.

You must immediately contact your webhost and inform them to restore your backup.

I highly recommend not to provide the "Upload" option in any of your website forms to allow readers to send you attachments. H***kers see it as an opportunity to attach malicious code that badly effects your data hierarchy and replaces your index.html page with index.php page of their own. This way they frighten you with a message on your homepage: "Your website is h***ked by XYZ!"

4. Fix 403 Forbidden Error in WordPress

If the error reads on your screen as:

Forbidden

You don't have permission to access '/' on this server.

Server unable to read htaccess file, denying access to be safe.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

403 Forbidden error is shown mostly when your server does not give permissions to access a specific page. This error is often caused by poorly coded third party security plugins, or server configuration.

To fix this error simply open Filezilla and locate .htaccess and delete it. Now check your site, if its resolved than your .htaccess file was corrupted.

You can then move ahead to generate a fresh .htaccess file. Simply log into WordPress and going to Settings » Permalinks page. Do not change anything and simply click the "Save Changes" button at the bottom of the page and you are done! A new .htaccess file will be automatically created in your root directory.

If in case you are looking for more details related to 403 error and want comprehensive tutorial on how to fix 403 error then head to this in-depth guide by 000webhost which covers A-Z details of WordPress 403 Forbidden Error and how to troubleshoot it.

I am sure the above methods will help you in easily fixing this error in future. Doing it for the first time will take some time and technical know-how but once you understand the basic steps, it would become a piece of cake the next time you encounter a 403 error.

5. Browser not showing the changes made on WordPress File Editor

Most often when you edit your CSS files or other related files in WordPress file editor, you fail to see the site reflecting the changes made.

This happens because the browser loads a cache of your last changes in order to speed up the load time the next time a user visits your pages. Even if you disable the WP Super Cache plugin or similar, the problem still remains there.  

To fix this problem, first try deleting your browser cache or close the tab and reopen the link.

If nothing worked, then hit Ctrl + U and find style.css link inside the source code of your site. Open it and then hit the refresh key (F5) 2-3 times. Now go back and reload the site to see the changes in action.

6. Custom Post Type 404 Errors

To troubleshoot 404 errors or custom post types follow these steps:

  1. Double check the names of Custom Post Types and static pages to see none have the same name. If they do, rename the single page, including the permalink.
  2. Next navigate to Settings > Permalinks. Select the option for default permalinks. Hit Save button. Then reselect your preferred permalink structure. This will update the rewrite rules and would solve the problem easily.

7. How to fix Pretty Permalinks 404

Most WordPress multisite users often experience 404 errors with pretty permalinks while uploading images. This happens because mod_rewrite is not be enabled in Apache by default.

To fix this error simply log into WP and reset your permalinks through Settings > Permalinks. Click the save button and you are done!

If this does not solve the problem then you can replace the contents of your .htaccess file with the following code either using Yoast plugin or Filezilla

# BEGIN WordPress  <IfModule mod_rewrite.c>  RewriteEngine On  RewriteBase /  RewriteRule ^index\.php$ - [L]  RewriteCond %{REQUEST_FILENAME} !-f  RewriteCond %{REQUEST_FILENAME} !-d  RewriteRule . /index.php [L]  </IfModule>  # END WordPress

8. Fix Internal Server Error

There are several ways that cause this error and we will discuss the major solutions to fixing this problem:

  • The most common reason is a corrupted .htaccess file. Simply log into FileZilla and copy your .htaccess file and save it on your local computer drive. Delete the one in your root directory. If the problem is fixed then regenerate a new .htaccess file by going to Settings > Permalinks > Click save button. This will generate a new .htaccess file.
  • Another reason could be a 3rd party plugin causing all the trouble. Deactivate all your plugins and see if your site loads properly. If it did load fine then try searching the plugin that was causing the problem by activating your plugins one-by-one until you see that error again. The last plugin you enabled is the culprit that you need to delete.
  • Switch the Theme to the classic WordPress Twenty Sixteen Theme to eliminate any Theme-related problems.
  • Another reason could be a memory limit. Contact your webhost and ask them to Increase the PHP Memory limit
  • The last and final method is to re-upload the wp-admin and wp-includes folders manually.

All these methods if applied correctly will surely bring your site back in order.

9. Fix the WordPress White Screen Of D***th

If you see nothing on your site's homepage but a blank page then know that its the WP white screen of d***th. It is caused either by a poorly coded WP plugin, theme or a corrupted .htaccess file. Apply all the methods that we discussed in point 8 i.e. "Fixing Internal server error".

10. How to fix syntax error in WordPress

Syntax error occurs most often when you incorrectly edit files such as functions.php file or any other file with .php extension using the WP file editor. You then come across an error on screen that either reads as "Parse error", "use of an undefined constant" or similar and shows you the line number where this error is occurring.

syntax errors in wordpress

A syntax error occurs when you make a mistake in writing the correct PHP structure code. It could be a missing terminator (;), or  comma, closing tag or a missing bracket.

If Parse Error error occurs then it means that you have forgotten to include a character. The most common are:

  • Unexpected '=' : you have not included the $ when referencing a variable
  • Unexpected ')' : you have not included the opening bracket (
  • Unexpected '(' : you have not included the closing bracket )
  • Unepxpected T_STRING: you have not included a quotation mark or a semi-colon at the end of the previous line
  • Unexpected T_ELSE: you have an else statement with no opening if statement

"Use of an Undefined constant" error also occurs when you have forgotten to include a character. It could be one of the following:

  • Missing a $ when referencing a variable
  • Missing quotation marks around array keys

The only way easy way to fix these errors is to open that specific PHP file in a FTP client such as FileZilla and make the necessary syntax edits and re-upload the file. That simple!

11. Fix Wordpress error "Maintenance Mode Following Upgrade"

Wordpress error Unavailable for schedule maintenance

Wordpress installs a .maintenance file when you run a WordPress update. During that time when WordPress is upgrading, your visitors will see this message for a short span of time "Briefly unavailable for scheduled maintenance. Please check back in a minute."

The maintenance file is a temporary file and is deleted as soon as the upgrade process completes but sometimes this file may not have been removed properly due to several reasons.

To fix this error simply connect to your site using FileZilla and inside the root directory folders, find and delete the .maintenance file.

That's it!

Conclusion

All these easy fixes really made my life at ease when I was new to WordPress. Not knowing these simple tweaks equals banging your head against the wall when you come across such frightening white screen errors. Educating yourself will not only reduce your development expenses this year (2018) but will also strengthen your technical skills and make you a well versed webmaster.

I hope this easy guide may help you in troubleshooting day to day errors faced in WordPress. I would love to answer any queries you might have. Please leave your queries in the comment box below.

Share:

0 comments:

Post a Comment