linux下编译安装php7(兼容现有的php5.6版本)

1.首先去php官网下载一个php7版本源码包 http://php.net/downloads.php,我这下载的是php7.2.13版本. 

2.使用ftp或者linux的rz命令将包上传到linux下,开始进行编译安装.

3.解压安装包

# tar -zxvf   php-7.2.13.tar.gz

# cd php-7.2.13

#./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-mcrypt=/usr/include --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache

执行以上编译会出现报错

1.configure: error: jpeglib.h not found.

解决:yum -y install libjpeg-devel .

2.configure: error: png.h not found.

解决:#yum install libpng 

 # yum install libpng-devel

3.configure: error: freetype-config not found.

解决:# yum install freetype-devel

然后再次执行上面命令会出现:

+--------------------------------------------------------------------+

| License:                                                           |

| This software is subject to the PHP License, available in this     |

| distribution in the file LICENSE.  By continuing this installation |

| process, you are bound by the terms of this license agreement.     |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this point.                            |

+--------------------------------------------------------------------+

Thank you for using PHP.

表示配置文件检测成功,下面开始执行编译且安装

# make && make install  

至此php就安装完成 .

猜你喜欢

转载自www.cnblogs.com/victorcode/p/10143536.html