【参考】
参考:https://blog.csdn.net/wwzuizz/article/details/89175941
参考:https://blog.csdn.net/dmedaa/article/details/89863165
参考:https://blog.csdn.net/chhnang2016/article/details/81010227
参考:https://blog.csdn.net/gooding300/article/details/86545919
【安装】
各种依赖包:
sudo apt update sudo apt -y install openssl sudo apt -y install libssl-dev sudo apt -y install curl sudo apt -y install libcurl4-openssl-dev sudo apt -y install libcurl4-gnutls-dev sudo apt -y install libbz2-dev sudo apt -y install libzip-dev sudo apt -y install libxpm-dev sudo apt -y install libxml2-dev sudo apt -y install libjpeg-dev sudo apt -y install libpng-dev sudo apt -y install libfreetype6-dev sudo apt -y install libmcrypt-dev sudo apt -y install libmysql++-dev sudo apt -y install libxslt1-dev sudo apt -y install libc-client-dev sudo apt -y install libkrb5-dev sudo apt -y install libsodium-dev
下载解压 PHP 源码包,并编译:
sudo apt update && apt -y install openssl && sudo apt -y install libssl-dev && sudo apt -y install curl && sudo apt -y install libcurl4-openssl-dev && sudo apt -y install libcurl4-gnutls-dev && sudo apt -y install libbz2-dev && sudo apt -y install libzip-dev && sudo apt -y install libxpm-dev && sudo apt -y install libxml2-dev && sudo apt -y install libjpeg-dev && sudo apt -y install libpng-dev && sudo apt -y install libfreetype6-dev && sudo apt -y install libmcrypt-dev && sudo apt -y install libmysql++-dev && sudo apt -y install libxslt1-dev && sudo apt -y install libc-client-dev && sudo apt -y install libkrb5-dev && sudo apt -y install libsodium-dev wget http://us2.php.net/distributions/php-7.3.14.tar.xz && tar -xvf php-7.3.14.tar.xz && cd php-7.3.14 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-zip --enable-soap --without-pear --with-gettext --enable-maintainer-zts --with-apxs2=/usr/local/apache2/bin/apxs --with-kerberos --with-imap --with-imap-ssl --with-xmlrpc --with-bz2 --with-xsl -with-sodium make -j8 && make install
【配置】
创建软连接:
ln -s /usr/local/php/bin/php /usr/local/bin/ && ln -s /usr/local/php/bin/phpize /usr/local/bin/ && ln -s /usr/local/php/bin/php-config /usr/local/bin/
php 配置文件:
cp /root/php-7.3.14/php.ini-production /usr/local/php/etc/php.ini
php-fpm 配置文件:
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf && cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
查看版本:
php -v
输出:
PHP 7.3.14 (cli) (built: Jan 7 2020 02:40:00) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
【扩展】
参考:https://amon.org/php-ioncube
参考:https://amon.org/php-xmlrpc
参考:https://amon.org/php-opcache
[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. ; curl.cainfo = ; curl.cainfo="/usr/local/php/etc/extras/ssl/ca-bundle.crt" ; Local Variables: ; tab-width: 4 ; End: track_errors=Off ; [ionCube Loader] ; zend_extension=/usr/local/ioncube/ioncube_loader_lin_7.3_ts.so ; [gd] ; extension = "gd.so" ; [imap] ; extension = "imap.so" ; [xmlrpc] ; extension = "xmlrpc.so" ; [intl] ; extension = "intl.so" ; [imagick] ; extension = "imagick.so" ; [redis] ;extension = "redis.so" ; [memcached] ;extension = "memcached.so" ; [opcache] ; zend_extension = "opcache.so" opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1
报错:PHP Startup: Invalid library (maybe not a PHP library) ‘xmlrpc.so’ in Unknown on line 0
参考:https://blog.csdn.net/tianfuhao123/article/details/89073168
这种情况一般发生在php7及以上,因为 已经把扩展编译到 PHP 里了,无需再需要额外单独添加扩展。