php源码编译安装
系统 Centos8.2
下载最新的php包
https://www.php.net/downloads
解压后进入包的目录进行一些php配置
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--with-iconv \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--with-bz2 \
--with-readline \
--without-sqlite3 \
--without-pdo-sqlite \
--with-pear \
--enable-maintainer-zts \
--enable-dtrace
- –prefix=/usr/local/php 指定php安装路径
- –with-config-file-path=/usr/local/php/etc 指定自己的php.ini路径 然后从源码里面 cp过去php.ini 源码里面有个php.ini-development和php.ini-production 如果不是本地调试模式的 选择后者。
- –enable-fpm 运行php-fpm
- –with-fpm-user=www 运行用户
报错
configure: error: Cannot find sys/sdt.h which is required for DTrace support
解决:
yum install -y systemtap systemtap-devel systemtap-sdt-devel
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met
解决:
yum install -y libxml2-devel
configure: error: Package requirements (openssl >= 1.0.1) were not met
解决
yum -y install openssl openssl-devel
configure: error: Please reinstall the BZip2 distribution
解决
yum -y install bzip2 bzip2-devel
configure: error: Package requirements (libcurl >= 7.15.5) were not met
解决
yum -y install curl-devel
checking for oniguruma... no configure: error: Package requirements (oniguruma) were not met
解决
configure: error: Please reinstall readline - I cannot find readline.h
解决
yum -y install readline-devel
安装
make && make install