11.10/11.11/11.12 安装PHP5
PHP官网www.php.net
当前主流版本为5.6/7.1
安装前请安装
yum install -y libxml2-developenssl openssl-develbzip2-devellibjpeg-devellibpng-devel
freetype-devellibXpm-devellibmcrypt-devel
cd /usr/local/src/
wget http://cn.php.net/distributions/php-5.6.32.tar.gz
tar xvf php-5.6.32.tar.gz
cd php-5.6.32
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc--with-mysql--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd--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
其他
/usr/local/php5/bin/php -i | less用-i 可查看php一些信息, 比如编译参数
/usr/local/php5/bin/php -m 查看php加载的模块
11.13 安装PHP7
cd /usr/local/src/
wget http://cn.php.net/distributions/php-7.2.0.tar.gz
tar xvf php-7.2.0.tar.gz
cd php-7.2.0/
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl--enable-soap--enable-mbstring --enable-sockets--enable-exif
make && make install
cp php.ini-production/usr/local/php7/etc/php.ini
其它
php7 ./configure 的时候已经不用 --with-mysql
/usr/local/php7/bin/php -i | less用-i 可查看php一些信息, 比如编译参数
/usr/local/php7/bin/php -m 查看php加载的模块
ls /usr/local/apache2.4/modules/libphp7.so 可查看php的的模块,如果安装过php5和php7 ,会有
libphp7.so和libphp5.so
/usr/local/apache2.4/bin/apachectl -M 查看http加载的模块, 如果装过php5和php7, 会同时看到
php7_module (shared) 和 php5_module (shared), 使用哪个根据自己的需求
vim /usr/local/apache2.4/conf/httpd.conf// 不想用哪个就把哪个注释掉,不注释掉一个启动http的时候会出错