pdo mysql.cache size_php5.4.4添加模块(memcache,Xcache,ImageMagick,PDO_MYSQL)

编译安装apache

wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.22.tar.gz

tar xf httpd-2.2.22.tar.gz

cd httpd-2.2.22

./configure --prefix=/usr/local/webserver/apache--sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib

make&& make install

编译php和php模块需要用到mysql ,所以要安装好mysql数据库后在进行下面的步骤

php5.4

到官网下载php5.4.4

cd php-5.4.4

./configure --prefix=/usr/local/php--with-mysql=/usr/local/webserver/mysql --with-openssl--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml--with-apxs2=/usr/local/webserver/apache/bin/apxs --with-openssl --with-mhash --disable-rpath --enable-discard-path --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi--with-config-file-path=/usr/local/php/etc

make ZEND_EXTRA_LIBS='-liconv'

make install

相关模块安装(memcache,xcache,PDO_mysql,ImageMagick):

memcache

tar zxvf memcache-2.2.5.tgz

cd memcache-2.2.5/

/usr/local/webserver/php/bin/phpize

./configure --with-php-config=/usr/local/webserver/php/bin/php-config

make

make install

cd ../

xcache

php5.4对于eaccelerator-0.9.6.1的兼容没有做好,安装过程会报错

eaccelerator-0.9.6.1/eaccelerator.c:1938: error: ‘eaccelerator_functions’ undeclared here (not in a function)

我们使用xcache代替

wget -c http://xcache.lighttpd.net/pub/Releases/2.0.1/xcache-2.0.1.tar.gz

tar xf xcache-2.0.1.tar.gz

cd xcache-2.0.1

/usr/local/webserver/php/bin/phpize

./configure --with-php-config=/usr/local/webserver/php/bin/php-config

make&&make install

PDO_MYSQL

ln -sv /usr/local/webserver/mysql/include/* /usr/local/include/

tar zxvf PDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2/

/usr/local/webserver/php/bin/phpize

./configure --with-php-config=/usr/local/webserver/php/bin/php-config--with-pdo-mysql=/usr/local/webserver/mysql

make

make install

cd ../

ImageMagick

tar zxvf ImageMagick.tar.gz

cd ImageMagick-6.5.1-2/

./configure

make

make install

cd ../

wget http://pecl.php.net/get/imagick

imagick 需要是最新版本的,如果是旧版本的安装会报错,我这里用的是imagick-3.1.0RC2.tgz

[root@localhost software]# tar xf imagick-3.1.0RC2.tgz

[root@localhost imagick-3.1.0RC2]# /usr/local/webserver/php/bin/phpize

Configuring for:

PHP Api Version:         20100412

Zend Module Api No:      20100525

Zend Extension Api No:   220100525

[root@localhost imagick-3.1.0RC2]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config

[root@localhost imagick-3.1.0RC2]# make install

Installing shared extensions:     /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/

Installing header files:          /usr/local/webserver/php/include/php/

php.ini配置

sed -i 's#extension_dir="./"#extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/"\nextension="memcache.so"\nextension="pdo_mysql.so"\nextension="imagick.so"\n#' /usr/local/webserver/php/etc/php.ini

在/usr/local/php/etc/php.ini中添加如下内容

[xcache-common]

zend_extension= /usr/local/php/lib/php/extensions/xcache.so

[xcache.admin]

; Change xcache.admin.user to your preferred login name

xcache.admin.user="admin"

; Change xcache.admin.pass to the MD5 fingerprint of your password

; Use md5 -s "your_secret_password" to find the fingerprint

xcache.admin.pass="e10adc3949ba59abbe56e057f20f883e"

[xcache]

; Change xcache.size to tune the size of the opcode cache

xcache.size=24M

xcache.shm_scheme="mmap"

xcache.count=2

xcache.slots=8K

xcache.ttl=0

xcache.gc_interval=0

; Change xcache.var_size to adjust the size of variable cache

xcache.var_size=8M

xcache.var_count=1

xcache.var_slots=8K

xcache.var_ttl=0

xcache.var_maxttl=0

xcache.var_gc_interval=300

xcache.test=Off

xcache.readonly_protection=On

xcache.mmap_path="/tmp/xcache"

xcache.coredump_directory=""

xcache.cacher=On

xcache.stat=On

xcache.optimizer=Off

[xcache.coverager]

xcache.coverager=On

xcache.coveragedump_directory=""

xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e"

结果需要使用echo -n "123456" | md5sum

求出hash值

apache的配置

将着两行添加到/etc/httpd/httpd.conf文件中去

AddType application/x-httpd-php  .php

AddType application/x-httpd-php-source  .phps

检查LoadModule php5_module        modules/libphp5.so  这一行是否被启用

如果被注释 就将它启用起来

然后启动httpd  方法

/usr/local/webserver/apache/bin/apachectl -k start|stop|restart

你可以写个测试页面测试模块加载是否正常

phpinfo();

?>

测试php和数据库连接是否正常

$link=mysql_connect('root',"localhost","passwd");

if (!$link)

echo "connecting faild..";

else

echo "connecting successful!!";

mysql_close();

?>

84a7c9fde2ada7689778f2786ff94199.png24b64df9625a1f215b2ce2fb91232c29.png2b7891e29b4493a651f531875d572bdd.png6e1646c3556369e0a249aa76615d006a.png

你也可以使用命令方式查看是否成功加载模块:

9c74fcd813172ebba97facb5e744ba9a.png

/usr/local/php/bin/php -m

6458de889c7a17807545c93c083f11c3.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值