How to install PHP eAccelerator on CentOS 7
How to install PHP eAccelerator on CentOS 7
The PHP eAccelerator is a open-source PHP accelerator that provides a bytecode cache. Every time a PHP script is run, PHP parses and compile into bytecode. eAccelerator optimizes the bytecode and caches into shared memory. It typically reduces server load and increases the speed of your PHP code by 1-10 times. This tutorial explains the installation of PHP eAccelerator on CentOS 7.
Installation procedure
Before starting the installation procedure, install the Apache Webserver by executing the following command and press y to continue with the installation procedure.
[root@linuxhelp Desktop]# yum install -y httpd
BDB2053 Freeing read locks for locker 0x3c7a: 3360/139856599390016
BDB2053 Freeing read locks for locker 0x3c7c: 3360/139856599390016
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.
.
httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 mailcap.noarch 0:2.1.41-2.el7
Complete!
Next Start and enable the Apache service by running the following command.
[root@linuxhelp Desktop]# systemctl start httpd & & systemctl enable httpd
Now use the following command to install PHP and its required dependencies. Press y to continue with the installation process.
[root@linuxhelp Desktop]# yum install php php-devel -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.
.
pcre.x86_64 0:8.32-15.el7_2.1
Complete!
Install the development tools by running the following command.
[root@linuxhelp Desktop]# yum groupinstall ' Development Tools'
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
.
.
rpm-build-libs.x86_64 0:4.11.3-21.el7 rpm-libs.x86_64 0:4.11.3-21.el7
rpm-python.x86_64 0:4.11.3-21.el7 systemtap-runtime.x86_64 0:3.0-7.el7
Complete!
Next download the PHP eAccelerator by executing the following wget command followed by the download link.
[root@linuxhelp Desktop]# wget https://github.com/eaccelerator/eaccelerator/zipball/master -O eaccelerator.zip
--2017-07-28 23:56:05-- https://github.com/eaccelerator/eaccelerator/zipball/master
Resolving github.com (github.com)... 192.30.255.112, 192.30.255.113
Connecting to github.com (github.com)|192.30.255.112|:443... connected.
.
.
2017-07-28 23:56:08 (201 KB/s) - ‘ eaccelerator.zip’ saved [155679]
The download of the PHP eAccelerator is complete. Now extract the downloaded zip file by running the unzip command.
[root@linuxhelp Desktop]# unzip eaccelerator.zip
Archive: eaccelerator.zip
42067ac7e2d55caa5d060580489f5043357ffbe2
creating: eaccelerator-eaccelerator-42067ac/
.
.
inflating: eaccelerator-eaccelerator-42067ac/win32/eAccelerator.sln
inflating: eaccelerator-eaccelerator-42067ac/win32/eAccelerator.vcproj
Enter into extracted eAcclerator directory by running the following command.
[root@linuxhelp Desktop]# cd eaccelerator-eaccelerator-42067ac/ [root@linuxhelp eaccelerator-eaccelerator-42067ac]#
Run the ./configure command to run the downloaded application.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
.
.
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
Next run the make and make install commands to install the eAccelerator application as follows.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# make /bin/sh /root/Desktop/eaccelerator-eaccelerator-42067ac/libtool --mode=compile cc -I. -I/root/Desktop/eaccelerator-eaccelerator-42067ac -DPHP_ATOM_INC -I/root/Desktop/eaccelerator-eaccelerator-42067ac/include -I/root/Desktop/eaccelerator-e . . Build complete. Don' t forget to run ' make test' . [root@linuxhelp eaccelerator-eaccelerator-42067ac]# make install Installing shared extensions: /usr/lib64/php/modules/ +-------------------------------------------------------+ | !!! Attention !!! | | | | For disk cache users (using eaccelerator.shm_only=0): | | | | Please remember to empty your eAccelerator disk cache | | when upgrading, otherwise things will break! | +-------------------------------------------------------+
Add the following values to eAccelerator php configuration file in the following path using vim editor /etc/php.d/eaccelerator.ini. Enter the following lines in the configuration file. Save and exit the file.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# vim /etc/php.d/eaccelerator.ini
[eaccelerator]
extension=" eaccelerator.so"
eaccelerator.shm_size = " 0"
eaccelerator.cache_dir = " /var/cache/php-eaccelerator"
eaccelerator.enable = " 1"
eaccelerator.optimizer = " 1"
eaccelerator.debug = 0
eaccelerator.log_file = " /var/log/httpd/eaccelerator_log"
eaccelerator.name_space = " "
eaccelerator.check_mtime = " 1"
eaccelerator.filter = " "
eaccelerator.shm_ttl = " 0"
eaccelerator.shm_prune_period = " 0"
eaccelerator.shm_only = " 0"
Next you need to create cache directory and set up the required permissions by executing the following command.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# mkdir -p /var/cache/php-eaccelerator [root@linuxhelp eaccelerator-eaccelerator-42067ac]# chmod 777 /var/cache/php-eaccelerator
Create the info.php file in the location /var/www/html/info.php and add following lines in info.php file. Save and exit the file.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# vim /var/www/html/info.php
< ?php
phpinfo()
?>
To enable a new php configuration we need to restart the web server by executing the following command.
[root@linuxhelp eaccelerator-eaccelerator-42067ac]# systemctl restart httpd
Open the browser and type the url as http://serverip/info.php and run it.
For further information scroll down on the page and you will see the eAccelerator details as shown below.
The installation of eAccelerator is complete. The eAccelerator avoids the performance overhead of repeated parsing and compilation.
Comments ( 0 )
No comments available