Tried everything to increase the speed of the website? But if you are still reading this article then surely caching plugins like W3 Total Cache didn’t help you much and you are still not happy about your site performance. If you haven’t tried the other options, you can try them out first.
Before starting this technique, there are some basic things which you should be aware of. Only some of us are aware of the fact that WordPress, the biggest CMS is based on PHP. Though there are a lot of advancements in PHP even though on latest version PHP 7.1. Most of the WordPress based sites still use version php5X just for the reason that it is more compatible with WordPress. But with advancements in PHP version 7.1, it can make a website load 3X faster. The reason for this is that the Execution and Processing power of PHP 7.1 is faster as compared to PHP 5X. So, how to get your website on PHP 7.1.
Let’s get started:
1. Backup site:
Just for a safer side take backup of your website including its database just in case if your site is not supportive to PHP 7.1.
2. Updating WP Core, plugins & theme:
SO first we start with updating all the components of WordPress like – Theme, Plugins and WordPress Core files. Outdated plugins and theme might not support the latest PHP version as they might be only tested on PHP 5X and aren’t compatible with the new one. So for moving on with this technique, it is important that your theme supports the latest PHP version. Once you have updated the wWordPress core files, themes, and plugins. Check your site once for its looks and functionality just to be sure that everything is working just fine as before.
3. Changing PHP Version:
Here we come to the final step of changing the version of PHP to latest 7.1. Once the updated website works fine, the version has to be changed. Changing the version of PHP is an easy step and differs based on the hosting your site is on.
a. Shared Hosting
Most of the sites are on Shared Hosting, and they are flexible with PHP 7.1. For Shared Hosting you can change it from your cPanel.
cPanel URL: your_website_url/cpanel
Once you login to your cPanel account goto>> PHP Selector/ Multi PHP Manager >> select the PHP Version and Don’t forget to save your settings.
b. Managed WordPress Hosting
In Managed WordPress Hosting you don’t have access or control over the settings of your site. So, if you have a Managed Hosting you just have to ask the provider to change the version for you.
c. VPS/ Dedicated Server
If you host a Dedicated Server for your website, changing the PHP version becomes a quite tricky. It mostly depends on different factors like the Control Panel that you are using. If you are using cPanel on your dedicated server, the process goes same like the Shared Hosting.
But if you don’t have cPanel installed, then things you need to follow are a bit more of a technical. In that case, you first need to install PHP 7.1 on your server using the command line and then set it as the default version.
Verify if PHP 7.1 is enabled?
Once PHP version is enabled, you need to check if it is working for your site. Verification is very easy. Create a PHP file named verify.php in root directory and in that file paste this code
<?php phpinfo(); ?>
And save this file. Now all you need to do is open this newly created file in the browser.
You will see the all technical information related to the PHP version. The top of the file denotes the version of the PHP version on which your site is working.
Now that you have verified the version of PHP. It is highly recommended that you check your site for its functionality.
After checking the functionality if you are getting error 500? Don’t be afraid? It is the most common error that occurs when you upgrade to PHP 7.1 from the older one. This error occurs if your theme or plugin is not supporting the new PHP version.
Now if your website is working fine. If your website shows no change or distortion. There is a reason for you to be happy. But before that, we need to be completely sure if it is working fine. For most of the times, there are some of the hidden errors which aren’t displayed anywhere or do not affect the functionality of the website.
For testing to be certain about the changes made we need to enable the debug mode in WordPress. This is quite simple. All you need to do is install a plugin named ‘Debug bar’. Once the plugin is installed and activated, you will notice a button in the top right corner of your WordPress Dashboard. All you need to do is turn it on to check for hidden errors. If you see no errors, then you are good to go, but if there are errors you need to fix them.
Content Delivery Network is a structure of network meant to dispense data (static) to the user from the server nearest to the user’s location. CDN Integration adds that much-needed benefit of speeding up the website. As already mentioned in my previous article about ways to speed up WordPress e-commerce website , CDN is a bit costlier than you think. But little people know that you can even set up SELF CDN. Isn’t this amazing? Self CDN is creating your own CDN network to improvise your site’s performance. Self-hosted CDN just like any other CDN service helps in optimizing your website speed.
Why do we need CDN?
So let’s see how the browser responds to your request when you visit any website. When you visit any URL, the browser first connects to the DNS server the get the required data to render the correct page which you have asked for. With the help of DNS browser connects to your server to fetch the data being requested.
But the drawback here is browser can carry only a specific number of files at a time. In this case, if a server has let’s say 200 files needed to render the page, the browser will carry this files in patches. In turn which will apparently increase the loading time of your website. As we are aware that a WordPress itself has a large number of files, which makes it a bit slow. This is where Self CDN can do the job for you.
How does Self Hosted CDN work?
Self Hosted CDN isn’t a real network but, It helps by parallelizing downloads across different domains. Self CDN draws static content from different subdomains, unlike the usual one where the data is dispensed from a single server. It is not necessary that you buy a new server to setup a self-hosted CDN you can use the same server by transferring some of the static content files to a subdomain or a new domain and store on the same server. This will just enable the browser to carry twice the number of records at a single request. As in this case browser sets two different connections to the server ultimately allowing it to take twice the number of files.
How to setup Self Hosted CDN?
Setting up Self Hosted CDN to your WordPress site is quite simple. All we need is W3 Total Cache Plugin. For the further listed steps, we’ll be using a local subdomain as our CDN address to store static content.
1. Turn on the CDN features in the general Setting and select the option of Generic Mirror in the field of CDN Type.
- -Host attachments
- -Host Theme files
- -Host minified CSS and JS files
- -Host Custom Files.
Don’t forget to save your changes.
3. As we are using the local subdomain for the CDN service, we need to have one ready. This can be created by logging into your cPanel account and go to the subdomain section. Create a subdomain of whichever name you want your CDN address to be. Here we will be using cdn1 as our subdomain.
4. Assign your subdomain to the ‘public_html’ folder so as to make it function like a Generic Mirror.
5. Go to cPanel’s advance DNS Zone Editor. Edit the cName of the newly created subdomains. While editing them, you need to change the Type to CNAME and adding the subdomain in the Name field, which will complete our Generic Mirror Settings
6. Now in the W3 Cache Configuration change, the CDN Hostname to the Self-Hosted CDN address – the subdomains we just created.
7. Next, we need to modify attachment URL’s present in the W3 Cache CDN settings. Here we just need to add subdomain and modify the URL.
Then all you need to do is HIT the START button.
Its, done. You have successfully created your Self CDN in quite a few steps, and you are ready to go.
Is your WordPress site slow? Is it taking ages to load? Do you want to speed up your site? There are different reasons why your WordPress site might be slow. In this article, we will be enlisting all the possible issues that we have personally come across and how to fix them. All of which we have tested and found to be useful in speeding up WordPress performance.