Ubuntu18.04 PHP升级到最新版本

在Ubuntu18.04上将PHP的版本从PHP7.3升级到PHP7.4,做如下记录

1.更新源
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

2.安装php7.4组件

sudo apt install php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-mysql php7.4-imagick

3.配置apache2 文件,调整内存大小、上传文件大小等参数

sudo vim /etc/php/7.4/apache2/php.ini
file_uploads = On
allow_url_fopen = On
short_open_tag = On
cgi.fix_pathinfo = 0
memory_limit = 1024M
max_execution_time = 360
upload_max_filesize = 200M
max_file_uploads = 200

4.禁用php7.3
sudo a2dismod php7.3

5.启动php7.4
sudo a2enmod php7.4
sudo systemctl restart apache2.service

6.删除php7.3组件
sudo apt-get purge `dpkg -l | grep php7.3| awk ‘{print $2}’ |tr “\n” ” “`

本文由作者 okass 发布在 TNEXT , 转载请联系service@tnext.org授权处理,获得授权后请保留文章的完整性并附上原文链接: https://tnext.org/6405.html

Tags:

We will be happy to hear your thoughts

发表评论

error: Content is protected !
TNEXT