1、 安装PHP5
• PHP官网www.php.net
• 当前主流版本为5.6/7.1
• cd /usr/local/src/
• wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
• tar zxf php-5.6.30.tar.gz
• cd php-5.6.30
• ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
• make && make install
• cp php.ini-production /usr/local/php/etc/php.ini
2、 安装PHP7
• cd /usr/local/src/
• wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
• tar zxf php-7.1.6.tar.bz2
• cd php-7.1.6
• ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
• make && make install
• ls /usr/local/apache2.4/modules/libphp7.so
• cp php.ini-production /usr/local/php7/etc/php.ini
常见问题:
使用yum install httpd就可以安装httpd,为什么还要这样使用源码包安装呢?是因为有功能的差异吗?
答:主要目的是要学习编译安装这个技能。 多数企业也是习惯使用编译安装的。
php中mysql,mysqli,mysqlnd,pdo到底是什么 http://blog.csdn.net/u013785951/article/details/60876816
查看编译参数 http://ask.apelearn.com/question/1295