创建编译文件
cd /software
tar zxf php-5.3.6.tar.gz
cd php-5.3.6
nano compiler-php.sh
输入以下内容,注意请按照你的 CPU 规格填写 CFLAGS 及 CXXFLAGS 特征,在此采用 Mysqlnd 实现 Mysql / Mysqli / PDO
#!/bin/bash
make distclean
DEST=/usr/local/webserver/php
CFLAGS='-O3 -axsse4.2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
CXXFLAGS='-O3 -axsse4.2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
CC=icc \
CXX=icpc \
LD=xild \
AR=xiar \
./configure \
-prefix=$DEST \
-enable-fpm \
-enable-force-cgi-redirect \
-enable-fastcgi \
-enable-mbstring \
-enable-mbregex \
-enable-pcntl \
-enable-exif \
-enable-sockets \
-enable-sysvsem \
-enable-sysvshm \
-enable-inline-optimization \
-enable-zend-multibyte \
-enable-xml \
-enable-discard-path \
-enable-bcmath \
-enable-shmop \
-enable-sysvsem \
-enable-sockets \
-enable-gd-native-ttf \
-with-mcrypt \
-with-gd \
-with-openssl \
-enable-inline-optimization \
-disable-ipv6 \
-disable-debug \
-disable-rpath \
-with-mysql=mysqlnd \
-with-mysqli=mysqlnd \
-with-pdo-mysql=mysqlnd \
-with-config-file-path=$DEST/etc \
-with-config-file-scan-dir=$DEST/etc/php.d \
-with-zlib \
-with-curl \
-with-curlwrappers \
-with-gettext \
-with-freetype-dir \
-with-iconv-dir=/usr/local \
-with-jpeg-dir \
-with-png-dir \
-with-libxml-dir=/usr \
-with-mhash \
-with-xmlrpc \
-enable-zip \
-enable-soap \
-with-pcre-regex
对编译文件授权并执行配置编译
chmod 777 compiler-php.sh
./compiler-php.sh
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /usr/local/webserver/php/etc/php.ini
编译安装 Memcached 及 PHP5 扩展模块
cd /software
tar zxf memcached-1.4.5.tar.gz
cd memcached-1.4.5
CC=icc \
CXX=icpc \
LD=xild \
AR=xiar \
CFLAGS='-O3 -axsse4.2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
CXXFLAGS='-O3 -axsse4.2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
make
make install
cd ../
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config CC=icc CXX=icpc CFLAGS=-O3 CXXFLAGS=-O3
make
make install
cd ../
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
/usr/local/webserver/php/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=/usr/local/webserver/php/bin/php-config CC=icc CXX=icpc CFLAGS=-O3 CXXFLAGS=-O3
make
make install
cd ../
修改 php.ini 配置
nano /usr/local/webserver/php/etc/php.ini
修改以下部分
extension_dir = “/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/”
output_buffering = On
cgi.fix_pathinfo=0在最后添加
extension = “memcache.so”[eaccelerator]
zend_extension=”/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
eaccelerator.shm_size=”64″
eaccelerator.cache_dir=”/usr/local/webserver/eaccelerator_cache”
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 缓存文件夹
mkdir -p /usr/local/webserver/eaccelerator_cache