cd /usr/local
yum install libXpm-devel
cd /usr/local
mkdir zlib
wget http://zlib.net/zlib-1.2.8.tar.gz
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure –prefix=/usr/local/zlib
make && make install
wget http://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.13/libpng-1.6.13.tar.gz
tar zxvf libpng-1.6.13.tar.gz
mv libpng-1.6.13 libpng-code
cd libpng-code
./configure –prefix=/usr/local/libpng
make
make install
cd /usr/local
wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
make
make install
cd /usr/local
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
tar zxvf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure –prefix=/usr/local/freetype
make
make install
cd /usr/local
wget https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz
tar zxvf libgd-2.1.0.tar.gz
cd libgd-2.1.0
./configure –prefix=/usr/local/gd –with-jpeg=/usr/local/jpeg –with-png=/usr/local/libpng –with-freetype=/usr/local/freetype
make
make install
cd /usr/local
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
mkdir -p /usr/local/libmcrypt
./configure prefix=/usr/local/libmcrypt/
make
make install
cd /usr/local
wget http://xmlsoft.org/sources/libxml2-2.9.0.tar.gz tar -zxvf libxml2-2.9.0.tar.gz cd libxml2-2.9.0 ./configure --prefix=/usr/local/libxml2 make make install
cd /usr/local
wget http://www.openssl.org/source/openssl-1.0.1i.tar.gz
cd openssl-1.0.1i
./config –enable-shared
make depend
make
make test
make install
yum install curl curl-devel
yum install openldap openldap-devel
yum install openssl openssl-devel
ln -s /usr/lib64/* /usr/llib
1 cd /usr/local
2 wget http://cn2.php.net/get/php-5.5.14.tar.gz/from/this/mirror
3 mkdir php
4 tar zxvf php-5.5.14.tar.gz
5 cd php-5.5.14
6 ./configure –prefix=/usr/local/php –with-mysql=mysqlnd –with-mysqli –with-apxs2=/usr/local/apache/bin/apxs –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –with-curl –with-gettext –with-mcrypt=/usr/local/libmcrypt –enable-zip –with-zlib=/usr/local/zlib –with-zlib-dir=/usr/loacl/lib –with-gd=/usr/local/gd –with-freetype-dir=/usr/local/freetype –with-pcre-dir=/usr/local/pcre –with-xpm-dir=/usr/lib –enable-ftp –with-openssl –enable-mbstring –enable-soap –with-ldap –with-config-file-path=/usr/local/php/etc –with-libxml-dir=/usr/local/libxml2
7 make
8 make test
9 make install
10 vi /usr/local/apache/conf/httpd.conf
11找到“AddType application”部分,在后面添加如下内容:
12 AddType application/x-httpd-php .php
开发时
13 cp /usr/local/php-5.5.14/php.ini-development /usr/local/php/etc/php.ini
生产时
13 cp /usr/local/php-5.5.14/php.ini-product /usr/local/php/etc/php.ini
14 /usr/local/apache/bin/apachectl.sh restart
15 touch /usr/local/apache/htdocs/index.php
16 vi /usr/local/apache/htdocs/index.php
17 内容书写为
<?php phpinfo(); ?>
18 访问http://localhost/index.php
如果能够显示php的相关信息而不是代码。则安装完成.
19 将php加入linux 环境变量
20 vi /etc/profile
21 在底部加入
PATH=$PATH:/usr/local/php/bin
export PATH
23 保存 并执行 source /etc/profile 使配置生效
24 cp /usr/local/php/bin/php /usr/bin/php
25 php -v 来确认是否添加成功。