一,安装前准备
cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.4.7.tar.gz
yum -yinstallgcc automake autoconf libtoolmake
yum -yinstallgcc gcc-c++ glibc
yum -yinstalllibmcrypt-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-develbzip2bzip2-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
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-xcache --enable-xcache-optimizer
make
make install
五 配置xcache
cat xcache.ini >> /etc/php.ini
echo -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为你的网站目录
本文原创发布php中文网,转载请注明出处,感谢您的尊重!