一,安裝前准備
cd /usr/local/src
wget http:
//cn2
.php.net
/distributions/php-5
.4.7.
tar
.gz
yum -y
install
gcc automake autoconf libtool
make
yum -y
install
gcc gcc-c++ glibc
yum -y
install
libmcrypt-devel mhash-devel libxslt-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
zlib zlib-devel glibc glibc-devel glib2 glib2-devel
bzip2
bzip2
-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel
1、編譯安裝PHP 5.2.13所需的支持庫:
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
二。開始安裝
tar
zvxf php-5.5.7.
tar
.gz
cd
php-5.5.7
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr
--enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --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-zip --enable-soap
make ZEND_EXTRA_LIBS='-liconv' (記得這個,否則變異不過去)
make install
如果找不到php.ini ,把當前目錄php.ini-product 復制到 /usr/local/php/lib 下,然後配置php.ini
然後配置你得php-fpm.conf. 在/usr/local/etc/下,
mv php-fpm.conf.default php-fpm.conf
三 安裝pdo mysql
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install
cd ../
如果報錯.ln -s /usr/local/mysql/include /usr/local/include
這是因為找不到到mysql的頭文件
四,安裝xcache
wget http://xcache.lighttpd.net/wiki/Release-3.1.0
tar zxvf xcache-3.1.0
make
make install
五 配置xcache
cat xcache.ini >> /etc/php.iniecho -n"12345"|md5sum 替換成你想要得用戶名,和上面生成密碼xcache.admin.user = "mOo" xcache.admin.pass = "5f4dcc3b5aa765d61d8327deb882cf99" 安裝後台管理cp -a ~/src/xcache/htdocs /var/www/example.com/htdocs/xcache-admin/var/www/example.com/htdocs為你的網站目錄