In this tutorial we’ll install Memcached and configure it in phpbb 3.2, which not only lower the server load also make you phpbb forum super fast I meant lightening fast. Memcached is used to lower the database load, it will cache the frequently used MySQL query and save as key cache on RAM – which will save the precious juice for another tasks.
For this tutorial full root access is required also it will work on shared hosting (cpanel) if memcached and php memcached are installed and enabled for your account.
Lets get started :-
Installing Memcached and PHP Memcached :
Centos/RHEL 6/7 :
First install Remi repo :-
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm
To install Memcached :
yum install memcached
Start memcached Service and enable on boot :
service memcached start #Centos/RHEL 7 systemctl enable memcached #Centos/RHEL 6 chkconfig memcached on
Ubuntu 16.04/18.04 LTS and other forks :
apt-get update apt-get install memcached
Installing PHP Memcached :
Now We’ll Build and install PHP MEMCACHED on php 7.xx (official) :
cd /root git clone https://github.com/php-memcached-dev/php-memcached.git cd php-memcached git checkout php7 phpize ./configure make make install
If you get SASL error then we need disable sasl flag added to the config:
cd /root git clone https://github.com/php-memcached-dev/php-memcached.git cd php-memcached git checkout php7 phpize ./configure --disable-memcached-sasl make make install
Now you need to add this line to your php.ini to enable this php extension :
Then at last restart apache/php-fpm service and done, you can then check phpinfo and search “memcached” if it is there then you’ve successfully installed php-memcached and memcached.
Configuring phpbb 3.2 with Memcached :
Edit config.php and find this line :
$acm_type = 'phpbb\\cache\\driver\\file';
Change it TO :
$acm_type = 'phpbb\\cache\\driver\\memcached';
save and exit, you’ve successfully enabled memcached for phpbb
also don’t forget to purge the forum cache.