nginx与apache的相关插件安装

查看版本

/application/apache/bin/apachectl -V

/application/nginx/sbin/nginx -v

/application/php/bin/php -v

mysql直接登陆就可以看到


查看编译的参数

/application/nginx/sbin/nginx -V  #用大V

/application/apache/build/config.nice

grep CONFIGURE_LINE /application/mysql/bin/mysqlbug

 

1.安装php引擎缓存加速器

解决perl的编译问题

echo export LC_ALL=C >> /etc/profile

source /etc/profile


安装eaccelerator (开发不活跃了)

安装xcache缓存加速模块

安装memcache客户端

安装PDO_MYSQL

安装imagickImageMagick(先装)

 

安装以上模块编译之前都需要进入到模块解压目录下执行

/application/php/bin/phpize

 

以下文字命令安装都是在nginx下安装的,apache的最后安装成功的存放路径不一样,是在

/application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/


1.

tar jxf 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

ll /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

 

2.

tar jxf 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

ll /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

 

3.

tar xf memcache-2.2.5.tgz

cd memcache-2.2.5

/application/php/bin/phpize

./configure --with-php-config=/application/php/bin/php-config

make && make install

ll /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

 

4.

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

make && make install

ll /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

出现一下报错可以忽略

[root@shnne PDO_MYSQL-1.0.2]# /application/php/bin/phpize

Configuring for:

PHP Api Version:         20090626

Zend Module Api No:      20090626

Zend Extension 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


5.

tar zxf ImageMagick.tar.gz

cd ImageMagick-6.5.1-2/

./configure

make

make install

cd ../

 

yum -y install perl-CPAN或者yum install perl-devel -y

没有执行上面的安装,会报错误

 

tar zxf imagick-2.3.0.tgz

cd imagick-2.3.0

ls

/application/php/bin/phpize

./configure --with-php-config=/application/php/bin/php-config

make && make install

ll /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

 

安装imagick php扩展插件

imagick插件工作需要ImageMagic软件支持,所以,必须先安装好ImageMagick

imagick插件是一个可以供php调用ImageMagick功能的扩展模块,使用这个扩展可以使PHP具备ImageMagick功能,使用imagick扩展才能使用ImageMagickapi来对图片进行操作


配置php.ini

; Directory in which the loadable extensions (modules) reside.

; http://php.net/extension-dir

; extension_dir = "./"

; On windows:

; extension_dir = "ext"

 

红字地方那个去掉分号,路径改为

extension_dir = "/application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/"

 

;--cache ext start by shnne 2017-10-12--

extension = memcache.so

extension = pdo_mysql.so

extension = imagick.so

;--cache ext end by shnne 2017-10-12--

 

配置eaccelerator加速

mkdir -p /tmp/eaccelerator

chown -R nginx.nginx /tmp/eaccelerator/

ll /tmp/eaccelerator/

 

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

 

/application/php/bin/php -v

pkill php-fpm   

/application/php/sbin/php-fpm

测试探针

 

配置插件XCache加速(跟eaccelerator有冲突,只需要配置其中一个即可)

cd /application/php/lib

echo >>php.ini

echo ';xcache config by shnne20171013----------------------' >>php.ini

tail -2 php.ini

vim /home/shnne/tools/nginx-php-ext-soft/xcache-1.3.2/xcache.ini

[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
extension = xcache.so
;; or win32:
; extension = php_xcache.dll
 
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""
 
[xcache]
; ini only settings, all the values here is default unless explained
 
; select low level shm/allocator scheme implemenation
xcache.shm_scheme =        "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size  =               128M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count =                 2
; just a hash hints, you can always store count(items) > slots
xcache.slots =                8K
; ttl of the cache item, 0=forever
xcache.ttl   =                 86400
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval =           3600
 
; same as aboves but for variable cache
xcache.var_size  =            4M
xcache.var_count =             1
xcache.var_slots =            8K
; default ttl
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300
 
xcache.test =                Off
; N/A for /dev/zero
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory.
; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection
; 2 group of php won't share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path
xcache.mmap_path =    "/dev/zero"
 
 
; leave it blank(disabled) or "/tmp/phpcore/"
; make sure it's writable by php (without checking open_basedir)
xcache.coredump_directory =   ""
 
; per request settings
xcache.cacher =               On
xcache.stat   =               On
xcache.optimizer =           Off
 
[xcache.coverager]
; per request settings
; enable coverage data collecting for xcache.coveragedump_directory and xcache_coverager_start/stop/get/clean() functions (will hurt executing performance)
xcache.coverager =          Off
 
; ini only settings
; make sure it's readable (care open_basedir) by coverage viewer script
; requires xcache.coverager=On
xcache.coveragedump_directory = ""

将以上内容cat xcache.ini >> php.ini

重启php测试


分享到:

网友留言(0 条)

发表评论