查看已安装PHP的configure参数
[root@localhost ~]# /program/php/bin/php -i | grep configure
温馨提示
--------------------------------------------------
1、安装较新版本的PHP建议先升级make、CMake,并将GCC切换至8.3版本(可使用scl切换,无需全新安装)。
2、安装较新版本的PHP建议先升级以下依赖库:
Requested 'libxml-2.0 >= 2.9.4' but version of libXML is 2.9.1 下载libxml2-2.9.4.tar.gz
Requested 'openssl >= 1.1.1' but version of OpenSSL is 1.0.2k 下载openssl-1.1.1.tar.gz
Requested 'zlib >= 1.2.11' but version of zlib is 1.2.7 下载zlib-1.2.11.tar.gz
Requested 'libcurl >= 7.61.0' but version of libcurl is 7.29.0 下载curl-7.61.0.tar.gz
安装上述依赖库时可以不使用--prefix参数指定安装目录,但需要设置如下环境变量(vim /etc/profile):
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib64/pkgconfig
3、在/etc/ld.so.conf文件里增加如下两个共享库(注意增加后要执行ldconfig更新缓存):
/usr/local/lib
/usr/local/lib64
如果升级了OpenSSL需要设置环境变量PKG_CONFIG_PATH
[root@localhost ~]# vim /etc/profile
…………此处省略内容若干…………
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/program/openssl/lib64/pkgconfig
[root@localhost ~]# source /etc/profile
PHP Version 8.4
--------------------------------------------------
./configure --prefix=/program/php-8.4 --bindir=/program/php-8.4/bin --exec-prefix=/program/php-8.4 --includedir=/program/php-8.4/include --libdir=/program/php-8.4/lib --mandir=/program/php-8.4/man --sbindir=/program/php-8.4/sbin --with-config-file-path=/program/php-8.4 --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-cgi --enable-cli --enable-ctype --enable-exif --enable-fileinfo --enable-fpm --enable-ftp --enable-gd --enable-gd-jis-conv --enable-intl --enable-ipv6 --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-opcache --enable-pcntl --enable-pdo --enable-phar --enable-session --enable-shared --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-static --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-xml --enable-zts --with-bz2 --with-curl --with-fpm-group=php --with-fpm-user=php --with-freetype --with-gettext --with-iconv --with-jpeg --with-ldap-sasl --with-libxml --with-mhash --with-mysqli --with-openssl --without-gdbm --with-pdo-mysql --with-pdo-sqlite --with-pear --with-readline --with-sqlite3 --with-tidy --with-webp --with-xpm --with-xsl --with-zlib
重要说明:如果执行./configure时报“configure: error: The iconv check failed, 'errno' is missing.”错误,可以安装较新版本的libiconv(无需指定--prefix参数),然后修改“--with-iconv”为“--with-iconv=/usr/local/bin”。
PHP Version 8.3
--------------------------------------------------
./configure --prefix=/program/php-8.3 --bindir=/program/php-8.3/bin --exec-prefix=/program/php-8.3 --includedir=/program/php-8.3/include --libdir=/program/php-8.3/lib --mandir=/program/php-8.3/man --sbindir=/program/php-8.3/sbin --with-config-file-path=/program/php-8.3 --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-cgi --enable-cli --enable-ctype --enable-exif --enable-fileinfo --enable-fpm --enable-ftp --enable-gd --enable-gd-jis-conv --enable-intl --enable-ipv6 --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-opcache --enable-pcntl --enable-pdo --enable-phar --enable-session --enable-shared --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-static --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-xml --enable-zts --with-bz2 --with-curl --with-fpm-group=php --with-fpm-user=php --with-freetype --with-gettext --with-iconv --with-jpeg --with-kerberos --with-ldap-sasl --with-libxml --with-mhash --with-mysqli --with-openssl --without-gdbm --with-pdo-mysql --with-pdo-sqlite --with-pear --with-readline --with-sqlite3 --with-tidy --with-webp --with-xpm --with-xsl --with-zlib
PHP Version 8.2
--------------------------------------------------
./configure --prefix=/program/php-8.2 --bindir=/program/php-8.2/bin --exec-prefix=/program/php-8.2 --includedir=/program/php-8.2/include --libdir=/program/php-8.2/lib --mandir=/program/php-8.2/man --sbindir=/program/php-8.2/sbin --with-config-file-path=/program/php-8.2 --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-cgi --enable-cli --enable-ctype --enable-exif --enable-fileinfo --enable-fpm --enable-ftp --enable-gd --enable-gd-jis-conv --enable-intl --enable-ipv6 --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-opcache --enable-pcntl --enable-pdo --enable-phar --enable-session --enable-shared --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-static --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-xml --enable-zts --with-bz2 --with-curl --with-fpm-group=php --with-fpm-user=php --with-freetype --with-gettext --with-iconv --with-jpeg --with-kerberos --with-ldap-sasl --with-libxml --with-mhash --with-mysqli --with-openssl --without-gdbm --with-pdo-mysql --with-pdo-sqlite --with-pear --with-readline --with-sqlite3 --with-tidy --with-webp --with-xpm --with-xsl --with-zlib
重要说明:如果执行./configure时报“configure: error: iconv does not support errno”错误,可以安装较新版本的libiconv(无需指定--prefix参数),然后修改“--with-iconv”为“--with-iconv=/usr/local/bin”。
PHP Version 8.1
--------------------------------------------------
./configure --prefix=/program/php-8.1 --exec-prefix=/program/php-8.1 --with-config-file-path=/program/php-8.1 --bindir=/program/php-8.1/bin --includedir=/program/php-8.1/include --libdir=/program/php-8.1/lib --mandir=/program/php-8.1/man --sbindir=/program/php-8.1/sbin --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-ctype --enable-exif --enable-fpm --enable-ftp --enable-intl --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-opcache --enable-pcntl --enable-session --enable-shared --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-xml --enable-zts --with-bz2 --with-curl --with-fpm-group=php --with-fpm-user=php --with-gettext --with-iconv --with-kerberos --with-ldap-sasl --with-mhash --with-mysqli --with-openssl --with-pdo-mysql --with-readline --with-xsl --with-zlib
PHP Version 7.4
--------------------------------------------------
[root@localhost ~]# export PKG_CONFIG_PATH=/program/openssl-1.0/lib/pkgconfig
[root@localhost ~]# export LD_LIBRARY_PATH=/program/openssl-1.0/lib
[root@localhost ~]# export OPENSSL_CONF=/program/openssl-1.0/ssl
[root@localhost ~]# scl enable devtoolset-8 bash
./configure --prefix=/program/php-7.4 --with-config-file-path=/program/php-7.4 --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-dom --enable-exif --enable-fileinfo --enable-filter --enable-fpm --enable-ftp --enable-gd-jis-conv --enable-inline-optimization --enable-json --enable-maintainer-zts --enable-mbregex --enable-mbstring --enable-mysqlnd-compression-support --enable-opcache --enable-pdo --enable-session --enable-shared --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-bz2 --with-cdb --with-curl --with-fpm-group=php --with-fpm-user=php --with-gettext --with-gmp --with-iconv --with-mhash --with-mysqli=mysqlnd --with-openssl=/program/openssl-1.0 --with-openssl-dir --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-pear --with-readline --with-sqlite3 --with-xmlrpc --with-xsl --with-zlib --with-zlib-dir
重要说明:如果升级了OpenSSL需要临时设置一下PKG_CONFIG_PATH、LD_LIBRARY_PATH、OPENSSL_CONF这三个环境变量,以引入旧版本OpenSSL相关文件。
PHP Version 7.2
--------------------------------------------------
./configure --prefix=/program/php-7.2 --with-config-file-path=/program/php-7.2 --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-dom --enable-exif --enable-fileinfo --enable-filter --enable-fpm --enable-ftp --enable-gd-jis-conv --enable-inline-optimization --enable-json --enable-maintainer-zts --enable-mbregex --enable-mbregex-backtrack --enable-mbstring --enable-mysqlnd-compression-support --enable-opcache --enable-pdo --enable-session --enable-shared --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zip --with-bz2 --with-cdb --with-curl --with-fpm-group=php --with-fpm-user=php --with-freetype-dir --with-gd --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-libmbfl --with-libxml-dir --with-mhash --with-mysqli=mysqlnd --with-onig --with-openssl --with-openssl-dir --with-pcre-dir --with-pcre-regex --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-pear --with-png-dir --with-readline --with-sqlite3 --with-xmlrpc --with-xsl --with-zlib --with-zlib-dir
PHP Version 5.6
--------------------------------------------------
./configure --prefix=/program/php-5.6 --with-config-file-path=/program/php-5.6 --with-fpm-group=php --with-fpm-user=php --with-mcrypt=/program/libmcrypt --with-gd --enable-opcache --disable-debug --disable-rpath --enable-bcmath --enable-calendar --enable-ctype --enable-exif --enable-fpm --enable-ftp --enable-gd-native-ttf --enable-inline-optimization --enable-maintainer-zts --enable-mbregex --enable-mbstring --enable-pcntl --enable-session --enable-shared --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --with-bz2 --with-curl --with-freetype-dir --with-gettext --with-iconv --with-jpeg-dir --with-kerberos --with-ldap-sasl --with-libxml-dir --with-mhash --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-png-dir --with-readline --with-xmlrpc --with-xsl --with-zlib