PHP各版本下载地址https://www.php.net/downloads.phpPHP8.1.1下载地址https://www.php.net/distributions/php-8.1.1.tar.gz安装wgethttps://www.php.net/distributions/php-8.1.1.tar.gztar-zxvf./php-8.1.1.tar.gzcdphp-8.1.1#编译./configure--prefix=/usr/local/php81--with-config-file-path=/usr/local/php81/etc--with-config-file-scan-dir=/usr/local/php81/conf.d--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-iconv=/usr/local--with-freetype=/usr/local/freetype--with-jpeg--with-zlib--enable-xml--disable-rpath--enable-bcmath--enable-shmop--enable-sysvsem--with-curl--enable-mbregex--enable-mbstring--enable-intl--enable-pcntl--enable-ftp--enable-gd--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-zip--enable-soap--with-gettext--enable-opcache--with-xsl--with-pearmakesudo安装#配置sudomkdir-p/usr/local/php81/{etc,conf.d}sudocp./php.ini-production/usr/local/php81/etc/php.inisudosed-i's/post_max_size=.*/post_max_size=50M/g'/usr/local/php81/etc/php.inisudosed-i's/upload_max_filesize=.*/upload_max_filesize=50M/g'/usr/local/php81/etc/php.inisudosed-i's/;date.timezone=.*/date.timezone=PRC/g'/usr/local/php81/etc/php.inisudosed-i's/short_open_tag=.*/short_open_tag=On/g'/usr/local/php81/etc/php.inisudosed-i's/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g'/usr/local/php81/etc/php.inisudosed-i's/max_execution_time=.*/max_execution_time=300/g'/usr/local/php81/etc/php.inisudosed-i's/disable_functions=.*/disable_functions=passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g'/usr/local/php81/etc/php.inisudo/usr/local/php81/bin/pear配置-设置php_ini/usr/local/php81/etc/php.inisudo/usr/local/php81/bin/peclconfig-setphp_ini/usr/local/php81/etc/php.inicat>/usr/local/php81/etc/php-fpm.conf<=0.11libzip!=1.3。1libzip!=1.7.0)werenotmet:#Downloadsource1.访问https://soft.vpser.net,根据目录级别选择libzip-1.3.2.tar.xz下载wgethttp://175.6.32.4:88/soft/lib/libzip/libzip-1.3.2.tar.xz#下载源码2w获取https://libzip.或者g/download/libzip-1.8.0.tar.xz#解压&编译安装tarxJflibzip-1.3.2.tar.xzcdlibzip-1.3.2/./configure--prefix=/usr/local/libzip-1.3.2makesudomakeinstallexportPKG_CONFIG_PATH='/usr/local/libzip-1.3.2/lib/pkgconfig'#指定参数--with-zip=/usr/local/libzip-1.3.2,reconfigureconfigure:error:iconvdoesnot支持errno#安装libiconv-1.16wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gztar-zxvflibiconv-1.16.tar.gz./configure--prefix=/usr/local/libiconvmakesudomakeinstall#添加--with-iconv=/usr/local/libiconv编译参数,reconfigurecollect2:error:ldreturned1exitstatusmake:*[sapi/cli/php]Error1#出现这个问题的原因是比较多,具体情况需要具体分析,下面是本例的思路ext/openssl/openssl.o:Infunction`zm_startup_openssl':/data/install/php-8.1.1/ext/openssl/openssl.c:1161:对`OPENSSL_init_ssl'ext/openssl/openssl.o的未定义引用:在函数`php_opens中sl_asn1_time_to_time_t':/data/install/php-8.1.1/ext/openssl/openssl.c:639:对`ASN1_STRING_get0_data'/data的未定义引用/install/php-8.1.1/ext/openssl/openssl.c:654:未定义引用`ASN1_STRING_get0_data'/data/install/php-8.1.1/ext/openssl/openssl.c:654:未定义引用`ASN1_STRING_get0_data'.../data/install/php-8.1.1/ext/openssl/xp_ssl.c:422:未定义对`OPENSSL_sk_num'/data/install/php-8.1.1/ext/openssl/xp_ssl.c的引用:425:未定义引用`OPENSSL_sk_value'/data/install/php-8.1.1/ext/openssl/xp_ssl.c:457:未定义引用`OPENSSL_sk_pop_free'/data/install/php-8.1.1/ext/openssl/xp_ssl.c:469:未定义引用`OPENSSL_sk_pop_free'/data/install/php-8.1.1/ext/openssl/xp_ssl.c:443:未定义引用`OPENSSL_sk_pop_free'ext/ftp/ftp.o:在函数中`ftp_login':/data/install/php-8.1.1/ext/ftp/ftp.c:271:未定义引用`TLS_client_method'/data/install/php-8.1.1/ext/ftp/ftp.c:280:undefinedreferenceto`SSL_CTX_set_options'collect2:error:ldreturned1exitstatusmake:***[sapi/cli/php]错误1#OpenSSL版本太低,升级OpenSSL,这里我直接升级到最新版本wgethttps://www.openssl.org/source/openssl-3.0.1.tar.gztar-zxfopenssl-3.0.1.tar.gzcdopenssl-3.0.1/./config-fPIC--prefix=/usr/local/openssl-3.0.1--openssldir=/usr/local/openssl-3.0.1makedependmakeinstall#重新编译exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/openssl-3.0。1/lib64/pkgconfig#添加--with-openssl-dir=/usr/local/openssl-3.0.1/bin编译参数,重新配置