首页 > 代码库 > Linux——搭建PHP开发环境第一步:PHP

Linux——搭建PHP开发环境第一步:PHP

原文链接:http://www.2cto.com/os/201511/450258.html

##### PHP 编译安装 ####

[root@localhost ~]# yum install libxml2-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel net-snmp net-snmp-devel
 
 
[root@localhost src]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
[root@localhost src]# tar zxvf libiconv-1.14.tar.gz
[root@localhost src]# cd libiconv-1.14
[root@localhost libiconv-1.14]# ./configure --prefix=/usr/local/php/libiconv
[root@localhost libiconv-1.14]# make && make install
 
 
[root@localhost src]# wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
[root@localhost src]# tar zxvf libmcrypt-2.5.8.tar.gz
[root@localhost src]# cd libmcrypt-2.5.8
[root@localhost libmcrypt-2.5.8]# ./configure
[root@localhost libmcrypt-2.5.8]# make && make install
 
 
[root@localhost libltdl]# /sbin/ldconfig && cd libltdl/
[root@localhost libltdl]# ./configure --enable-ltdl-install
[root@localhost libltdl]# make && make install
 
 
[root@localhost src]# wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
[root@localhost src]# tar zxvf mhash-0.9.9.9.tar.gz
[root@localhost src]# cd mhash-0.9.9.9
[root@localhost mhash-0.9.9.9]# ./configure
[root@localhost mhash-0.9.9.9]# make && make install
 
[root@localhost src]# wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
[root@localhost src]# tar zxvf mcrypt-2.6.8.tar.gz
[root@localhost src]# cd mcrypt-2.6.8
[root@localhost mcrypt-2.6.8]# /sbin/ldconfig && export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
[root@localhost mcrypt-2.6.8]# ./configure 
[root@localhost mcrypt-2.6.8]# make && make install
 
 
[root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.15.tar.gz
[root@localhost src]# tar zxvf php-5.6.15.tar.gz
[root@localhost src]# cd php-5.6.15
 
[root@localhost php-5.6.15]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc  --with-iconv=/usr/local/php/libiconv --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-pear --with-freetype-dir --with-zlib --with-libxml-dir --with-iconv-dir --with-xmlrpc --with-mhash --with-mcrypt --with-curl --with-openssl --with-snmp --with-gettext --enable-pdo --enable-mbstring --enable-ctype --enable-simplexml --enable-ftp --enable-sockets --enable-gd-native-ttf --enable-sysvsem --enable-exif --enable-sysvshm --enable-xml --enable-dom --enable-simplexml --enable-shmop --enable-zip --enable-mbregex --enable-bcmath --enable-inline-optimization --enable-soap
 
[root@localhost php-5.6.15]# make && make install
 
[root@localhost php-5.6.15]# cp php.ini-production /usr/local/php/etc/php.ini
[root@localhost ~]# ln -s /usr/local/php/bin/* /usr/sbin/

  

//查看版本

php -v

Linux——搭建PHP开发环境第一步:PHP