CentOS 5.4下 Nginx+Apache搭建前后端web生产环境(3)

tar -zxf libiconv-1.13.1.tar.gz

cd libiconv-1.13.1/

./configure

make

make install

cd /usr/local/src

tar -jxf libmcrypt-2.5.8.tar.bz2

cd libmcrypt-2.5.8/

./configure

make

make install

/sbin/ldconfig

cd libltdl/

./configure –enable-ltdl-install

make

make install

cd /usr/local/src

tar -jxf mhash-0.9.9.9.tar.bz2

cd mhash-0.9.9.9/

./configure

make

make install

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

cd /usr/local/src

tar -zxf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

/sbin/ldconfig

./configure

make

make install

2.编译php,这里我们为php打入补丁.有助于防止邮件发送被滥用(多用户)以及在邮件中提供有价值的信息.补丁介绍信息请点 击:~steveb/patches/php-mail-header-patch/

cd /usr/local/src

tar -zxf php-5.2.13.tar.gz

patch -d php-5.2.13 -p1 < php5-mail-header.patch

cd php-5.2.13

./configure –prefix=/usr/local –with-config-file-path=/etc –with-apxs2=/usr/local/apache/bin/apxs –enable-bcmath –enable-calendar –enable-exif –enable-ftp –enable-gd-native-ttf –enable-libxml –enable-magic-quotes –enable-mbstring –enable-pdo=shared –enable-soap –enable-sockets –enable-zip –with-bz2 –with-curl –with-curlwrappers –with-freetype-dir –with-gd –with-gettext –with-jpeg-dir –with-kerberos –with-libexpat-dir=/usr –with-libxml-dir=/usr –with-mcrypt=/usr –with-mhash=/usr –with-mysql=/usr –with-mysql-sock=/var/lib/mysql/mysql.sock –with-mysqli=/usr/bin/mysql_config –with-openssl=/usr –with-openssl-dir=/usr –with-pdo-mysql=shared –with-pdo-sqlite=shared –with-png-dir=/usr –with-sqlite=shared –with-ttf –with-xmlrpc –with-zlib -with-zlib-dir=/usr

make ZEND_EXTRA_LIBS=’-liconv’

make install

cp php.ini-dist /etc/php.ini

3.安装php扩展模块

cd /usr/local/src

tar -zxf memcache-2.2.5.tgz

cd memcache-2.2.5/

phpize

./configure –with-php-config=/usr/local/bin/php-config –with-zlib-dir –enable-memcache

make

make install

cd /usr/local/src

tar -jxf eaccelerator-0.9.6.tar.bz2

cd eaccelerator-0.9.6/

phpize

./configure –enable-eaccelerator=shared –with-php-config=/usr/local/bin/php-config

make

make install

mkdir -p /tmp/eaccelerator

chmod 777 /tmp/eaccelerator

echo "mkdir -p /tmp/eaccelerator" >> /etc/rc.local

echo "chmod 777 /tmp/eaccelerator" >> /etc/rc.local

cd /usr/local/src

tar -zxf ImageMagick.tar.gz

cd ImageMagick-*

./configure

make

make install

cd /usr/local/src

tar -zxf imagick-2.3.0.tgz

cd imagick-2.3.0/

phpize

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

make

make install

cd /usr/local/src

tar -zxf suhosin-0.9.29.tgz

cd suhosin-0.9.29

phpize

./configure

make

make install

cd /usr/local/src

tar -zxf ioncube_loaders_lin_x86.tar.gz

cd ioncube

mkdir /usr/local/ioncube

mv ioncube_loader_lin_5.2.so /usr/local/ioncube/

cd /usr/local/src

tar -zxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

mkdir -p /usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.x

cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.x/ZendOptimizer.so

3.1.修改php.ini.

查找/etc/php.ini中的extension_dir = "./".将其修改为extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"

查找;include_path = ".:/php/includes",删除前面的分号,并修改为include_path = ".:/usr/lib/php:/usr/local/lib/php"

跳到最后一行,然后添加以下内容:

extension = "memcache.so"

extension = "pdo.so"

extension = "pdo_mysql.so"

extension = "pdo_sqlite.so"

extension = "sqlite.so"

extension = "eaccelerator.so"

eaccelerator.shm_size = 32

eaccelerator.cache_dir = "/tmp/eaccelerator"

eaccelerator.enable = 1

eaccelerator.optimizer = 0

eaccelerator.debug = 0

eaccelerator.name_space = ""

eaccelerator.check_mtime = 1

eaccelerator.filter = ""

eaccelerator.shm_max = 0

eaccelerator.shm_ttl = 7200

eaccelerator.shm_prune_period = 7200

eaccelerator.shm_only = 1

eaccelerator.compress = 0

eaccelerator.compress_level = 9

eaccelerator.keys = shm

eaccelerator.sessions = shm

eaccelerator.content = shm

zend_extension = "/usr/local/ioncube/ioncube_loader_lin_5.2.so"

zend_extension = "/usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.x/ZendOptimizer.so"

4,安装Memcached(可选)

cd /usr/local/src

tar -xzf libevent-1.4.13-stable.tar.gz

cd libevent-1.4.13-stable

./configure

make

make install

ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib

cd /usr/local/src

tar -xzf memcached-1.4.4.tar.gz

cd memcached-1.4.4

./configure –with-libevent=/usr

make

make install

基本使用方法:

启动:/usr/local/bin/memcached -d -m 64 -p 11211 -u nobody -l localhost

关闭:killall -9 memcached

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygzwj.html