首頁 > 後端開發 > PHP問題 > ubuntu怎麼重新安裝php

ubuntu怎麼重新安裝php

藏色散人
發布: 2023-03-09 22:20:01
原創
3085 人瀏覽過

ubuntu重新安装php的方法:首先通过“sudo a2dismod php5”禁用掉其他版本的PHP;然后重新安装php7.2;最后安装常用扩展即可。

ubuntu怎麼重新安裝php

本文操作环境:ubuntu 18.04系统、PHP7.2版,DELL G3电脑

ubuntu怎么重新安装php?UBUNTU18.04 安装与卸载 PHP7.2

安装:

如果之前有其他版本PHP,在这边禁用掉

1

sudo a2dismod php5

登入後複製

再来安装做准备

1

2

3

4

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

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

sudo apt-get -y install php7.2

sudo a2enmod php7.2

登入後複製

安装常用扩展

1

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

登入後複製

安装其他扩展(按需安装)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

sudo apt-get install php7.2-gd

sudo apt-get install php7.2-soap

sudo apt-get install php7.2-gmp  

sudo apt-get install php7.2-odbc     

sudo apt-get install php7.2-pspell   

sudo apt-get install php7.2-bcmath 

sudo apt-get install php7.2-enchant  

sudo apt-get install php7.2-imap     

sudo apt-get install php7.2-ldap     

sudo apt-get install php7.2-opcache

sudo apt-get install php7.2-readline 

sudo apt-get install php7.2-sqlite3  

sudo apt-get install php7.2-xmlrpc

sudo apt-get install php7.2-bz2

sudo apt-get install php7.2-interbase

sudo apt-get install php7.2-pgsql    

sudo apt-get install php7.2-recode   

sudo apt-get install php7.2-sybase   

sudo apt-get install php7.2-xsl

sudo apt-get install php7.2-cgi      

sudo apt-get install php7.2-dba

sudo apt-get install php7.2-phpdbg   

sudo apt-get install php7.2-snmp     

sudo apt-get install php7.2-tidy     

sudo apt-get install php7.2-zip

登入後複製

卸载:

一、删除php的相关包及配置

1

sudo apt-get autoremove php7*

登入後複製

二、删除关联

1

sudo find /etc -name "*php*" |xargs  rm -rf

登入後複製

三、清除dept列表

1

sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

登入後複製

四、检查是否卸载干净(无返回就是卸载完成)

1

dpkg -l | grep php7.0

登入後複製

推荐学习:《PHP视频教程

以上是ubuntu怎麼重新安裝php的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板