>  기사  >  백엔드 개발  >  우분투에서 PHP를 다시 설치하는 방법

우분투에서 PHP를 다시 설치하는 방법

藏色散人
藏色散人원래의
2021-05-26 09:59:502860검색

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

우분투에서 PHP를 다시 설치하는 방법

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

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

安装:

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

sudo a2dismod php5

再来安装做准备

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

安装常用扩展

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

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

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的相关包及配置

    sudo apt-get autoremove php7*

二、删除关联

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

三、清除dept列表

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

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

    dpkg -l | grep php7.0

推荐学习:《PHP视频教程

위 내용은 우분투에서 PHP를 다시 설치하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.