centos7编译安装PHP7.3
一般用yum就够了,这个场景是要弄出多版本的php,所以需要自己编译


解压源码之后进入目录执行配置
./configure \
--prefix=/usr/local/php7.3.0 \
--with-config-file-path=/usr/local/php7.3.0/etc \
--enable-fpm \
--enable-opcache\
--with-pdo-mysql=mysqlnd \
--enable-sockets \
--enable-zip \
--enable-bcmath \
--with-zlib \
--with-iconv \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-xmlrpc \
--enable-mbstring \
--with-curl \
--with-openssl \
--enable-pcntl


检测的时候会出现很多错误,常见的如下

运行之后遇到的问题:

checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
# 解决办法
yum install libxml2-devel.x86_64
checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
解决办法
yuminstallopenssl.x86_64 openssl-devel.x86_64 -y

checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
解决办法
yum install bzip2-devel.x86_64 -y

configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
解决办法
yum install libcurl.x86_64 libcurl-devel.x86_64 -y

checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
configure: error: jpeglib.h not found
解决办法
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
如果还是不行
yum -y install libjpeg-devel

configure: error: Unable to locate gmp.h
解决办法
yum install -y gmp-devel

总之就是缺啥装啥,一直装到没有错就完事了

# make &&make install
# cp -R ./sapi/fpm/php-fpm.conf /usr/local/php5.4.44/etc/php-fpm.conf
# cp php.ini-development /usr/local/php5.4.44/lib/php.ini
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm5.4.44

出现
Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| 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.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating main/php_config.h
config.status: executing default commands
表示安装成功
make&& make install
make完成之后到php的解压目录 找出php.ini-production 复制到 /usr/local/php/lib/ 下 文件名改成php.ini
cp php.ini-production /usr/local/php/lib/php.ini
完成..


修改php-fpm.conf的侦听端口为9001,因为主版本5.5.28是侦听9000。

作者:倒霉狐狸

标签:

创建时间: 2018-12-19 17:42 最后更新时间:2018-12-19 18:44

苏ICP备15039362号 © 2015 纸喵软件 EverNote