1.PHP缓存加速器
1.先调整字符集(字符集影响正则匹配) echo 'export LC_ALL=C'>> /etc/profile source /etc/profile 2.安装perl相关软件 yum -y install perl-CPAN 或 yum -y install perl-devel 3.安装第一款-缓存加速模块《php eAccelerator》 tar xf eaccelerator-0.9.6.tar.bz2 cd eaccelerator-0.9.6 /application/php/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=/application/php/bin/php-config make && make install 安装出现路径。查看有eaccelerator.so文件表示安装成功
第二款-缓存加速模块《XCache》(二选一) tar xf xcache-1.3.2.tar.bz2 cd xcache-1.3.2 /application/php/bin/phpize ./configure --enable-xcache --with-php-config=/application/php/bin/php-config make && make install 安装出现路径。查看有xcache.so文件表示安装成功
2.数据库缓存及其他扩展插件
Memcache缓存软件(客户端) tar xf memcache-2.2.5.tgz cd memcache-2.2.5 /application/php/bin/phpize ./configure --enable-xcache --with-php-config=/application/php/bin/php-config make && make install 安装PDO_MYSQL扩展模块 tar xf PDO_MYSQL-1.0.2.tgz cd PDO_MYSQL-1.0.2 /application/php/bin/phpize ./configure --with-php-config=/application/php/bin/php-config --with-pdo-mysql=/application/mysql
3.安装图像处理程序及imagick扩展插件
1.安装ImageMagick图像软件 tar xf ImageMagick.tar.gz cd ImageMagick-6.5.1-2 ./configure make && make install 2.安装imagick PHP扩展插件 tar zxf imagick-2.3.0.tgz cd imagick-2.3.0 /application/php/bin/phpize ./configure --with-php-config=/application/php/bin/php-config make && make install
开始配置
vim /php/lib/php.ini
找到此项,改成模块路径 extension_dir = "/application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/" 到末尾,添加,保存即可,LAMP重启apache,LNMP重启php-fpm extension = memcache.so extension = pdo_mysql.so extension = imagick.so
#eAccelerator缓存插件配置 mkdir -p /tmp/eaccelerator chown -R apache.apache /tmp/eaccelerator cat >>/www/server/php/53/etc/php.ini<<EOF [eaccelerator] extension=eaccelerator.so eaccelerator.shm_size="64" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="3600" eaccelerator.shm_prune_period="3600" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" EOF [root@A-host imagick-2.3.0]# /application/php/bin/php -v PHP 5.3.27 (cli) (built: Aug 14 2018 18:26:25) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with eAccelerator v0.9.6, Copyright (c) 2004-2010 eAccelerator, by eAccelerator [root@E-host PDO_MYSQL-1.0.2]# ll /tmp/eaccelerator/ total 64 drwxrwxrwx 18 root root 4096 Aug 16 03:21 0 drwxrwxrwx 18 root root 4096 Aug 16 03:21 1 drwxrwxrwx 18 root root 4096 Aug 16 03:21 2 drwxrwxrwx 18 root root 4096 Aug 16 03:21 3 drwxrwxrwx 18 root root 4096 Aug 16 03:21 4 drwxrwxrwx 18 root root 4096 Aug 16 03:21 5 drwxrwxrwx 18 root root 4096 Aug 16 03:21 6 drwxrwxrwx 18 root root 4096 Aug 16 03:21 7 drwxrwxrwx 18 root root 4096 Aug 16 03:21 8 drwxrwxrwx 18 root root 4096 Aug 16 03:21 9 drwxrwxrwx 18 root root 4096 Aug 16 03:21 a drwxrwxrwx 18 root root 4096 Aug 16 03:21 b drwxrwxrwx 18 root root 4096 Aug 16 03:21 c drwxrwxrwx 18 root root 4096 Aug 16 03:21 d drwxrwxrwx 18 root root 4096 Aug 16 03:21 e drwxrwxrwx 18 root root 4096 Aug 16 03:21 f 表示已生效 find /tmp/eaccelerator/ -type f
XCache配置 配置文件在解压目录的xcache.ini 把第3、6行 ;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcac he.so ;zend_extension_ts = c:/php/extensions/php_xcache.dll 注释掉 第8行 extension = xcache.so 打开 xcache.ini 内容全加到php.ini里即可 cat tools/xcache-1.3.2/xcache.ini >>php.ini
停留在世界边缘,与之惜别