目录
一、安装PHP5
二、安装PHP7
扩展 php中mysql,mysqli,mysqlnd,pdo到底是什么 http://blog.csdn.net/u013785951/article/details/60896816
查看编译参数:http://ask.apelearn.com/question/1295
安装PHP5
-
cd /usr/local/src/
-
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
-
prefix 安装目录
-
with-apxs2 apche工具 自动配置
-
with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config 三个不同的库
-
6.error xml2-config not found. please check your libxml2 installation
7.yum install -y libxml2-devl 安装缺少的包
8.yum install -y openssl-devl
9.yum install bzip2 bzip2-devel
10.yum install -y libjpeg-devel
11.yum install -y libpng-devel
12.yum install -y freetype-devel
13.yum install epel-release
14.yum install libmcrypt-devel
15.error Cannot find libmysqlclient_r under /usr/local/mysql
16.编译之前,先处理一下mysql的库,默认查找libmysqlclient_r.so,可是mysql默认为libmysqlclient.so,内容完全一样,做个链接即可
# cd /usr/local/mysql/lib
# ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so
17.make
18.make install
19.查看php5加载模块 /usr/local/php/bin/php -m
20.cp php.ini-production /usr/local/php/etc/php.ini
21./usr/local/php/bin/php -i |less 查看php参数
安装PHP7
-
cd /usr/local/src/
-
tar jvxf 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
-
可以同时存在两个php, 但是apache调用时要指定好
-
查看php7加载模块 /usr/local/php7/bin/php -m
-
查看apache加载了几个Php
/usr/local/apache2.4/bin.apachectl -M
10.vi /usr/local/apache2.4/conf/httpd.conf 指定调用哪个php
![3ad17458f6f0cf268f56acfa6c5100d2b14.jpg](https://i-blog.csdnimg.cn/blog_migrate/5f791187ed2f2269a44b23d627b55f07.jpeg)