| 
 
 linux系統(tǒng)版本 [root@localhost~]# cat /etc/redhat-release CentOSrelease 6.5 (Final) [root@localhost~]# uname -r 2.6.32-431.el6.x86_64 Nginx版本 [root@localhost~]# /application/nginx/sbin/nginx -v nginxversion: nginx/1.10.1 Mysql版本 [root@localhost~]# mysqladmin -uroot -p'mysql123' version mysqladmin? Ver 8.42 Distrib 5.1.72, forunknown-linux-gnu on x86_64 Copyright(c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is aregistered trademark of Oracle Corporation and/or its affiliates.Other names may be trademarks of their respective owners. Serverversion????????? 5.1.72 Protocol version??????? 10 Connection??????????? Localhost via UNIX socket UNIXsocket?????????? /application/mysql-5.1.72/tmp/mysql.sock Uptime:???????? 8 hours 13 min 37 sec Threads: 1 Questions:2646 Slow queries: 0 Opens: 382? Flushtables: 1 Open tables: 4 Queries per second avg: 0.89 PHP版本 [root@localhost~]# /application/php/bin/php -v PHP 5.3.27(cli) (built: Sep 27 2016 15:15:29) Copyright(c) 1997-2013 The PHP Group Zend Enginev2.3.0, Copyright (c) 1998-2013 Zend Technologies 
 [root@localhost~]# echo 'export LC_ALL=C'>>/etc/profile [root@localhost~]# tail -1 /etc/profile exportLC_ALL=C [root@localhost~]# . /etc/profile????? [root@localhost~]# echo $LC_ALL C 
 下載軟件 [root@localhosttools]#wget https:///projects/eaccelerator/files/eaccelerator/eAccelerator 0.9.6/eaccelerator-0.9.6.tar.bz2/download Location:http://jaist.dl./project/eaccelerator/eaccelerator/eAccelerator 0.9.6/eaccelerator-0.9.6.tar.bz2[following] --2016-09-2814:35:53--?http://jaist.dl./project/eaccelerator/eaccelerator/eAccelerator 0.9.6/eaccelerator-0.9.6.tar.bz2 Resolvingjaist.dl.... 150.65.7.130, 2001:df0:2ed:feed::feed Connectingto jaist.dl.|150.65.7.130|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:105833 (103K) [application/octet-stream] Saving to:`eaccelerator-0.9.6.tar.bz2' 100%[===============>]105,833????? 376K/s?? in 0.3s??? 2016-09-2814:35:59 (376 KB/s) - `eaccelerator-0.9.6.tar.bz2' saved [105833/105833] 解壓軟件 [root@localhosttools]# tar jxf eaccelerator-0.9.6.tar.bz2 [root@localhosttools]# cd eaccelerator-0.9.6 [root@localhosteaccelerator-0.9.6]# /application/php/bin/phpize Configuringfor: PHP ApiVersion:???????? 20090626 Zend ModuleApi No:????? 20090626 ZendExtension Api No:?? 220090626 編譯安裝 [root@localhosteaccelerator-0.9.6]# ./configure --enable-eaccelerator=shared --with-php-config=/application/php/bin/php-config creatinglibtool appendingconfiguration tag "CXX" to libtool configure:creating ./config.status config.status:creating config.h [root@localhosteaccelerator-0.9.6]# echo $? 0 [root@localhosteaccelerator-0.9.6]# make && make install ---------------------------------------------------------------------- Buildcomplete. Don'tforget to run 'make test'. Installingshared extensions:?/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ [root@localhosteaccelerator-0.9.6]# ll/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ total 408 -rwxr-xr-x.1 root root 416805 Sep 28 14:42 eaccelerator.so 安裝完成 4、PHP的memcache緩存擴(kuò)展模塊安裝 ? ? ? memcache分:客戶端(memcache)與服務(wù)端(memcached) 下載軟件 [root@localhosttools]# wget http://pecl./get/memcache-2.2.5.tgz --2016-09-2814:53:05--?http://pecl./get/memcache-2.2.5.tgz Resolvingpecl.... 104.236.228.160 Connectingto pecl.|104.236.228.160|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:35981 (35K) [application/octet-stream] Saving to:`memcache-2.2.5.tgz' 100%[============>]35,981????? 34.5K/s?? in 1.0s??? 2016-09-2814:53:12 (34.5 KB/s) - `memcache-2.2.5.tgz' saved [35981/35981] [root@localhosttools]# tar zxf memcache-2.2.5.tgz [root@localhosttools]# cd memcache-2.2.5 [root@localhostmemcache-2.2.5]# /application/php/bin/phpize Configuringfor: PHP ApiVersion:???????? 20090626 Zend ModuleApi No:????? 20090626 ZendExtension Api No:?? 220090626 編譯安裝 [root@localhostmemcache-2.2.5]# ./configure ?--with-php-config=/application/php/bin/php-config creatinglibtool appendingconfiguration tag "CXX" to libtool configure:creating ./config.status config.status:creating config.h [root@localhostmemcache-2.2.5]# make && make install Buildcomplete. Don'tforget to run 'make test'. Installingshared extensions:????/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ [root@localhostmemcache-2.2.5]# ll/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ total 652 -rwxr-xr-x.1 root root 416805 Sep 28 14:42 eaccelerator.so -rwxr-xr-x.1 root root 246688 Sep 28 16:14 memcache.so 
 下載軟件 [root@localhosttools]# wget http://pecl./get/PDO_MYSQL-1.0.2.tgz --2016-09-2816:17:16--?http://pecl./get/PDO_MYSQL-1.0.2.tgz Resolvingpecl.... 104.236.228.160 Connectingto pecl.|104.236.228.160|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:14778 (14K) [application/octet-stream] Saving to:`PDO_MYSQL-1.0.2.tgz' 100%[===========>]14,778????? 54.5K/s?? in 0.3s??? 2016-09-2816:17:27 (54.5 KB/s) - `PDO_MYSQL-1.0.2.tgz' saved [14778/14778] 解壓軟件 [root@localhosttools]# tar zxf PDO_MYSQL-1.0.2.tgz [root@localhosttools]# cd PDO_MYSQL-1.0.2 [root@localhostPDO_MYSQL-1.0.2]# /application/php/bin/phpize Configuringfor: PHP ApiVersion:???????? 20090626 Zend ModuleApi No:????? 20090626 ZendExtension Api No:?? 220090626 config.m4:104:warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain_cv_ to be cached ../../lib/autoconf/general.m4:1974:AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:1994:AC_CACHE_CHECK is expanded from... aclocal.m4:2754:PHP_CHECK_PDO_INCLUDES is expanded from... config.m4:104:the top level config.m4:104:warning: AC_CACHE_VAL(pdo_inc_path, ...): suspicious cache-id, must contain_cv_ to be cached ../../lib/autoconf/general.m4:1974:AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:1994:AC_CACHE_CHECK is expanded from... aclocal.m4:2754:PHP_CHECK_PDO_INCLUDES is expanded from... config.m4:104:the top level 編譯安裝 [root@localhostPDO_MYSQL-1.0.2]# ./configure --with-php-config=/application/php/bin/php-config --with-pdo-mysql=/application/mysql/ creatinglibtool appendingconfiguration tag "CXX" to libtool configure:creating ./config.status config.status:creating config.h [root@localhostPDO_MYSQL-1.0.2]# make && make install ---------------------------------------------------------------------- Buildcomplete. Don'tforget to run 'make test'. Installingshared extensions:????/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ [root@localhostPDO_MYSQL-1.0.2]# ll/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ total 808 -rwxr-xr-x.1 root root 416805 Sep 28 14:42 eaccelerator.so -rwxr-xr-x.1 root root 246688 Sep 28 16:14 memcache.so -rwxr-xr-x.1 root root 157356 Sep 28 16:21 pdo_mysql.so 
  ? ? ?imagick擴(kuò)展模塊依賴于ImageMagick這個(gè)軟件,因此需要下載兩個(gè)軟件,先安裝ImageMagick這個(gè)軟件,后裝imagick擴(kuò)展模塊 下載軟件 [root@localhosttools]# wget --no-check-certificatehttps:///projects/imagemagick/files/old-sources/6.x/6.5/ImageMagick-6.5.1-10.tar.gz/download --2016-09-2817:06:08--?http://jaist.dl./project/imagemagick/old-sources/6.x/6.5/ImageMagick-6.5.1-10.tar.gz Resolvingjaist.dl.... 150.65.7.130, 2001:df0:2ed:feed::feed Connectingto jaist.dl.|150.65.7.130|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:11139020 (11M) [application/x-gzip] Saving to:`ImageMagick-6.5.1-10.tar.gz' 100%[=========================>]11,139,020?? 127K/s?? in 86s???? 2016-09-2817:07:41 (126 KB/s) - `ImageMagick-6.5.1-10.tar.gz' saved [11139020/11139020] 解壓編譯安裝 [root@localhosttools]# tar zxf ImageMagick-6.5.1-10.tar.gz [root@localhosttools]# cd ImageMagick-6.5.1-10 [root@localhostImageMagick-6.5.1-10]# ./configure ? PCFLAGS?????? = -fopenmp ? DEFS???????? = -DHAVE_CONFIG_H ? LDFLAGS???????? = -lfreetype ? MAGICK_LDFLAGS? = -L/usr/local/lib -lfreetype ? LIBS??????????? = -lMagickCore -lfreetype -ljpeg-lfontconfig -lX11 -lz -lm -lgomp -lpthread ? CXX???????????? = g ? CXXFLAGS??????? = -g -O2 -Wall -W -pthread [root@localhostImageMagick-6.5.1-10]# make && make install 下載軟件 [root@localhosttools]# wget http://pecl./get/imagick-2.3.0.tgz --2016-09-2816:50:50--?http://pecl./get/imagick-2.3.0.tgz Resolvingpecl.... 104.236.228.160 Connectingto pecl.|104.236.228.160|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:86976 (85K) [application/octet-stream] Saving to:`imagick-2.3.0.tgz' 100%[======================>]86,976????? 77.9K/s?? in 1.1s??? 2016-09-2816:50:57 (77.9 KB/s) - `imagick-2.3.0.tgz' saved [86976/86976] 解壓編譯安裝 [root@localhosttools]# tar zxf imagick-2.3.0.tgz [root@localhosttools]# cd imagick-2.3.0 [root@localhostimagick-2.3.0]# /application/php/bin/phpize Configuringfor: PHP ApiVersion:???????? 20090626 Zend ModuleApi No:????? 20090626 ZendExtension Api No:?? 220090626 [root@localhostimagick-2.3.0]# ./configure --with-php-config=/application/php/bin/php-config creatinglibtool appendingconfiguration tag "CXX" to libtool configure:creating ./config.status config.status:creating config.h [root@localhostimagick-2.3.0]# make && make install ---------------------------------------------------------------------- Buildcomplete. Don'tforget to run 'make test'. Installingshared extensions:????/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ [root@localhostimagick-2.3.0]# ll /application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/ total 1856 -rwxr-xr-x.1 root root? 416805 Sep 28 14:42eaccelerator.so -rwxr-xr-x.1 root root 1071009 Sep 28 17:22 imagick.so -rwxr-xr-x.1 root root? 246688 Sep 28 16:14memcache.so -rwxr-xr-x.1 root root? 157356 Sep 28 16:21pdo_mysql.so 
 [root@localhost~]# cd /application/php/lib/??????? 操作前備份 [root@localhostlib]# cp php.ini php.ini.bak.0929 [root@localhostlib]# ls php? php.ini?php.ini.bak.0929 [root@localhost lib]#vi php.ini ; Thedirectory under which PHP opens the script using /~username used only ; ifnonempty. ;http:///user-dir user_dir = ; Directoryin which the loadable extensions (modules) reside. ;http:///extension-dir ;extension_dir= "./"?? 修改目錄路徑 extension_dir ="/application/php-5.3.27/lib/php/extensions/no-debug-non-zts-20090626/" ; Onwindows: ;extension_dir = "ext" 然后到文件內(nèi)容的結(jié)尾增加如下配置 ;php cacheconfig start extension =memcache.so ?extension = pdo_mysql.so ?extension = imagick.so ;php cacheconfig end by root 2016-09-29 注意,PHP配置文件中注釋是用;而不是#號(hào)? 配置緩存插件eaccelerator 創(chuàng)建臨時(shí)緩存目錄 [root@localhostlib]# mkdir -p /tmp/eaccelerator [root@localhostlib]# chown -R nginx.nginx /tmp/eaccelerator/  ? ?生產(chǎn)環(huán)境當(dāng)中可以將此文件放在內(nèi)存文件系統(tǒng)(tmpfs)中存儲(chǔ),提高并發(fā)時(shí)的速度,也可以存放在固態(tài)硬盤(pán)中 [root@localhostlib]# cat >> /application/php/lib/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@localhostlib]# tail -25 /application/php/lib/php.ini ; LocalVariables: ;tab-width: 4 ; End: ;php cacheconfig start extension =memcache.so ?extension = pdo_mysql.so ?extension = imagick.so ;php cacheconfig end by root 2016-09-29 [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" 
 查看eaccelerator [root@localhostlib]# /application/php/bin/php -v PHP 5.3.27(cli) (built: Sep 27 2016 15:15:29) Copyright(c) 1997-2013 The PHP Group Zend Enginev2.3.0, Copyright (c) 1998-2013 Zend Technologies ??? with eAccelerator v0.9.6, Copyright (c)2004-2010 eAccelerator, by eAccelerator [root@localhostlib]# tree /tmp/eaccelerator/ /tmp/eaccelerator/ |-- 0 |?? |-- 0 |?? |-- 1 |?? |-- b |?? |-- c |?? |-- d |?? |-- e |?? `-- f |-- 5?????????? --------------------------->中間部分內(nèi)容省略 檢查語(yǔ)法 [root@localhostlib]# /application/php/sbin/php-fpm -t [29-Sep-201606:47:18] NOTICE: configuration file /application/php-5.3.27/etc/php-fpm.conftest is successful 重啟服務(wù) [root@localhostlib]# pkill php-fpm [root@localhostlib]# /application/php/sbin/php-fpm?? 訪問(wèn)PHP站點(diǎn) [root@localhostlib]# tree /tmp/eaccelerator/??????????????????????????????????????? /tmp/eaccelerator/ |-- 4 |?? |??|-- eaccelerator-86746.052265 |?? |??|-- eaccelerator-86746.242265 |?? |??|-- eaccelerator-86746.252265 |?? |??|-- eaccelerator-86746.352265 |?? |??|-- eaccelerator-86746.442265 |?? |??|-- eaccelerator-86746.452265 |?? |??|-- eaccelerator-86746.542265 |?? |??|-- eaccelerator-86746.552265 |?? |??|-- eaccelerator-86746.642265 | ??|?? `--eaccelerator-86746.742265 |?? |-- 5 |?? |??|-- eaccelerator-86746.115265 |?? |??|-- eaccelerator-86746.205265 |?? |??|-- eaccelerator-86746.305265 |?? |??|-- eaccelerator-86746.705265 |?? |??|-- eaccelerator-86746.805265 |?? |??`-- eaccelerator-86746.905265 |?? |-- 7????????????- ----------------------------->部分內(nèi)容省略 已經(jīng)有緩存文件生成 | 
|  | 
來(lái)自: 印度阿三17 > 《開(kāi)發(fā)》