跳至正文

PHP7.3安装(多版本共存)

安装ppa

sudo apt-get install software-properties-common python-software-properties

添加源并更新源

sudo add-apt-repository ppa:ondrej/php && sudo apt-get update

安装php7.3

sudo apt-get install php7.3

安装常用扩展

sudo -y apt-get install php7.3-fpm php7.3-mysql php7.3-curl php7.3-json php7.3-mbstring php7.3-xml php7.3-intl

安装其他扩展(按需安装)
sudo apt-get install php7.3-gd
sudo apt-get install php7.3-soap
sudo apt-get install php7.3-gmp
sudo apt-get install php7.3-odbc
sudo apt-get install php7.3-pspell
sudo apt-get install php7.3-bcmath
sudo apt-get install php7.3-enchant
sudo apt-get install php7.3-ldap
sudo apt-get install php7.3-opcache
sudo apt-get install php7.3-readline
sudo apt-get install php7.3-sqlite3
sudo apt-get install php7.3-xmlrpc
sudo apt-get install php7.3-bz2
sudo apt-get install php7.3-interbase
sudo apt-get install php7.3-pgsql
sudo apt-get install php7.3-recode
sudo apt-get install php7.3-sybase
sudo apt-get install php7.3-xsl
sudo apt-get install php7.3-cgi
sudo apt-get install php7.3-dba
sudo apt-get install php7.3-phpdbg
sudo apt-get install php7.3-snmp
sudo apt-get install php7.3-tidy
sudo apt-get install php7.3-zip

修改nginx配置

/etc/nginx/sites-available/default

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;改为对应版本(可在/etc/php/7.0/fpm/pool.d/www.conf查看)

出错参考

https://wzfou.com/nextcloud-install/

卸载php以及安装php7.4

查看php安装了那些包
dpkg -l | grep ‘php’
sudo apt-get purge php-cli php-common php-gd php-mbstring php-pear php-xml php7.0 php7.0-cgi php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml

apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update

apt-get install php7.4 php7.4-fpm php7.4-mysql php7.4-gd php7.4-mbstring php7.4-xml

修改nginx监听文件

service nginx restart

wordpress出现错误可打开debug模式查看出错代码
定位Crayon Syntax Highlighter 插件出错
wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php
定位到
return preg_replace(‘/[^\w-+#]/msi’, ”, $id);
修改为
return preg_replace(‘/[^\w-+#]/msi’, ”, $id);

发表回复