PHP加速器
Centos 7上編譯安裝 xcache-5.X
百度清華大學yum源
選擇remi源列表下的:
[維護的企業Linux(RHEL / CentOS /其他克隆)]
Enterprise Linux 8-存儲庫自動配置軟件包: remi-release-8.rpm
Enterprise Linux 7-存儲庫自動配置軟件包: remi-release-7.rpm
Enterprise Linux 6-存儲庫自動配置軟件包: remi-release-6.rpm
------------------------------------------------------------------------------------
yum -y install https:
yum -y install php56-php php56-php-mysqlnd php56-php-devel mariadb-server httpd gcc
systemctl start httpd.service mariadb.service
systemctl enable --now httpd.service mariadb.service
wordpress-5.2.4-zh_CN.tar.gz
tar xf wordpress-5.2.4-zh_CN.tar.gz -C /var/www/html/
chown -R apache.apache /var/www/html/wordpress
mysql
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO wordpress@'localhost' IDENTIFIED BY 'wordpress';
FLUSH PRIVILEGES;
- 瀏覽器訪問192.168.26.47/wordpress/並設置
//命令行測試沒有加速之前的wordpress處理訪問的速度
ab -c 10 -n 100 http://192.168.26.47/wordpress/
xcache-3.2.0.tar.gz
tar xf xcache-3.2.0.tar.gz
cd xcache-3.2.0/
yum provides phpize
rpm -ql php56-php-cli
/opt/remi/php56/root/usr/bin/phpize
find /opt/remi/ -name "php-config"
./configure --enable-xcache --with-php-config=/opt/remi/php56/root/usr/bin/php-config
make && make install
Installing shared extensions: /opt/remi/php56/root/usr/lib64/php/modules/
/opt/remi/php56/root/etc/php.ini
cat xcache.ini >> /opt/remi/php56/root/etc/php.ini
systemctl restart httpd.service
vim /var/www/html/test.php
<?php
phpinfo();
?>
- 瀏覽器訪問192.168.26.47/test.php/並且ctrl+f搜索Xcache(顯示模塊已經加載)
//再測試一遍wordpress的訪問速度
ab -c 10 -n 100 http://192.168.26.47/wordpress/
Centos 8 實現opcache加速-7.X
dnf -y install php-fpm php-mysqlnd mariadb-server httpd
systemctl start httpd.service mariadb.service php-fpm
wordpress-5.2.4-zh_CN.tar.gz
tar xf wordpress-5.2.4-zh_CN.tar.gz -C /var/www/html/
chown -R apache.apache /var/www/html/wordpress
mysql
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO wordpress@'localhost' IDENTIFIED BY 'wordpress';
FLUSH PRIVILEGES;
- 瀏覽器訪問192.168.26.18/wordpress/並設置
//命令行測試沒有開啓opcache加速之前的wordpress處理訪問的速度
ab -c 10 -n 100 http://192.168.26.18/wordpress/
dnf -y install php-opcache
systemctl restart php-fpm
ab -c 10 -n 100 http:
vim /etc/php.d/10-opcache.ini
; Enable Zend OPcache extension module
zend_extension=opcache
; Determines if Zend OPCache is enabled
opcache.enable=1
systemctl restart php-fpm