十周第一次课(12月18日)
11.10/11.11/11.12 安装PHP5
11.13 安装PHP7
php中mysql,mysqli,mysqlnd,pdo到底是什么
http://blog.csdn.net/u013785951/article/details/60876816
查看编译参数
http://ask.apelearn.com/question/1295
安装PHP5
当前主流版本为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
[root@wwlinux701 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
/apxs–apache工具,自动能用http-m加载模块
–检测报错解决
checking for xml2-config path…
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install -y libxml2-devel
yum install -y epel-release –需要先安装epel扩展源。借助第三方源安装
yum install -y libmcrypt-devel
./configure到这个提示完成
再make && make install
[root@wwlinux701 php-5.6.30]#cp php.ini-production /usr/local/php/etc/php.ini
#查看是否加载配置文件
[root@wwlinux701 php-5.6.30]# /usr/local/php/bin/php -i |less
安装php7
cd /usr/local/src
wget http://php.net/distributions/php-7.1.10.tar.gz -O php-7.1.10.tar.gz
tar zxf php-7.1.10.tar.gz
[root@wwlinux701 php-7.1.10]# ./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
安装完以后下面有两个so文件
[root@wwlinux701 php-7.1.10]# ls /usr/local/apache2.4/modules/libphp
libphp5.so libphp7.so
查看apache加载了几个php
/usr/local/apache2.4/bin/apachectl -M
更改配置文件启用哪个php,不想用哪个就把哪个注释掉
vim /usr/local/apache2.4/conf/httpd.conf
[root@wwlinux701 php-7.1.10]# ls /usr/local/apache2.4/modules/libphp7.so
/usr/local/apache2.4/modules/libphp7.so
[root@wwlinux701 php-7.1.10]# cp php.ini-production /usr/local/php7/etc/php.ini
[root@wwlinux701 php-7.1.10]#