Updated on Jan 6, 2016
The optimization of your phpBB 3 board can be performed by many ways, however before you can begin with this procedure you will need to analyze the resource consumption of your board and of course to check its loading speed.
This can be easily achieved if you look at the resource consumption of your board via your cPanel > Resource Consumption and also if you test your Board via some of the online speed checking tools.
Assuming that you have received not satisfying results from these checks you will probably want to optimize the loading speed and in this tutorial we will show you few techniques for doing so.
First technique we will present you with is related to the optimization of your database. Since your database is the main storage unit where all of the forums, posts, user information and configurations are stored you will need to determinate if its size is too large and what generates this size. You can perform that via the phpMyAdmin feature of your cPanel.
There, once you access the database you will be able to sort the tables of your database by size in order to determinate which from the tables are with the most largest size.
Usually if you have spam posts on your Board you will notice how the *_posts table will be probably largest. In such case you will need to remove the spam posts and reduce the size of that table.
You should do so for every table you are finding with needlessly large size and once you are ready with the reducing of that size you should run the following procedures for all of your tables of your database:
In order to run these you should select all of the tables in your database and scroll down to the bottom of the tables view page where you will find a drop-down menu called “With Selected”. There you will find the mentioned scripts.
You should do that action for each one of these procedures – selecting all of the tables and then selecting the procedure.
Now that you have your database optimized it is time to optimize the loading speed of your website by enabling few server side features.
The first feature is called Leverage browser caching and it is related to setting an expiry date or a maximum age in the HTTP headers for static resources.
This action will instructs the browser to load previously downloaded resources from local disk rather than over the network. In simple words you will allow your users to cache the static contents of your website on their local computers which will allow these resources to be loaded from there instead downloaded each time they access your phpBB 3 Board.
In order to activate this feature you will need to add few additional lines in the .htaccess file of your board using for example the Code Edit feature of the File Manager service provided in your cPanel. Once you open the file for editing please paste the following lines in it:
## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule> ## EXPIRES CACHING ##
These direct instructions will tell the browsers to cache the listed resources for period of 1 year.
The second feature is also an optimization you can perform by adding some extra lines to the .htaccess file of your phpBB 3 Board. This feature is called Mod_Deflate and it serves for the compression of static contents. The compression is reducing the overall size of the downloaded static contents by your users which is dramatically decreasing the loading time in combination of the Mod_Expires directives we have mentioned above. In order to activate the compression please paste the following line into the .htaccess file of your phpBB3 installation:
<ifModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript </ifModule>
In this step we will discuss some other additional optimization techniques which are commonly used on VPS/Dededicated Server solutions as the shared hosting environment will not always allow these.
The feature is called Memcache and it is NOT natively supported by the phpBB 3 platform. In order to have this feature installed you will need to download a single file from the authors of the ACM plugin and place the downloaded file in the following folder of your phpBB 3 installation:
/phpBB3_installation_folder/includes/acm/
Where the “phpBB3_installation_folder” is the folder where your phpBB3 installation is located. The file should be named the same way as the above URL suggests - acm_memcache.php.
Once you have the file in the correct folder you should get back to the installation folder of your website and find the config.php file where you will need to change some code. Please find the following line of code in that file:
$acm_type = 'file'
And replace that ling entirely with the following:
$acm_type = 'memcache'
This will tell your board that the Memcache apache module is installed and it can begin using it.