qns_fengyusong 发表于 2018-12-11 12:13:57

26期20180731 php5 install php7 install

7月31日任务
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安装在 aming1.
安装顺序是有一个安排的,先mysql 后php
http://s1.运维网.com/images/20180527/1527426463149546.png

[*]到src目录,下载,解压。bz2文件的解压命令,tar -xvf
[*]cd php目录,然后执行configure命令来进行编译。 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/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 。前面主要是apache的模块安装,接下来是php
执行编译的时候出现了一个错误。http://s1.运维网.com/images/20180527/1527428294243215.png
就是openssl找不到,yum 找一下,实际上需要安装的是 yum install openssl openssl-devel。 继续编译。
接下来又出现了一个错误,http://s1.运维网.com/images/20180527/1527428510681870.png,解决办法 yum install bzip2-devel
接下里又出现了一个错误,是libpng缺失,用这个命令安装。 yum install libjpeg-devel
不出意外的,又出现一个错误。http://s1.运维网.com/images/20180527/1527429058420878.png,yum install freetype-devel
新的错误出现,http://s1.运维网.com/images/20180527/1527429590498196.png。因为这个包是属于epel扩展库的,所以如果需要使用必须提前安装epel扩展库的。然后 yum install libmcrypt-devel.
http://s1.运维网.com/images/20180527/1527429924978083.png编译成功。
[*]接下来是make,make install 。装的位置是/usr/local/php
[*]可以看到有一个.so文件,这个就是php和apache结合的文件。http://s1.运维网.com/images/20180527/1527431340785278.png
[*]查看php下所加载的静态模块的命令。 bin/下 php -m http://s1.运维网.com/images/20180527/1527431478333500.png 。实际上php是httpd的一个模块存在的。
[*]通过/usr/local/php/bin/php -i 可以查看php信息 http://s1.运维网.com/images/20180528/1527464643682799.png
[*]拷贝配置文件到/php/etc下。http://s1.运维网.com/images/20180528/1527464936768676.pngcp /usr/local/src/php-5.6.32/php.ini-production /usr/local/php/etc/php.ini










CentOS7 装在aming1
http://s1.运维网.com/images/20180528/1527465060878682.png
注意在编译的时候没有 --with-mysql
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/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


完成安装。但是要知道的事情是,一个apache只能一次调用一个php,所以要指定使用的是哪个php

http://s1.运维网.com/images/20180528/1527471340862289.png
可以看到,加载了几个php,5和7都加载了。
http://s1.运维网.com/images/20180528/1527471422351749.png


如何选择用哪个?到配置文件里进行修改。
vim /usr/local/apache2/conf/httpd.conf
会发现有两个php的模块,注释掉不需要的。
http://s1.运维网.com/images/20180528/1527471699961659.png



页: [1]
查看完整版本: 26期20180731 php5 install php7 install