How do I uninstall PHP?

Hey guys,

I been trying to upgrade PHP from 5.5.32, to anything beyond 5.6, ideally PHP 7.

 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
 yum install yum-utils

After that, you can install the specific version of PHP you want with one of the following:

Install PHP 5.5

 yum-config-manager --enable remi-php55

Install PHP 5.6

 yum-config-manager --enable remi-php56

Install php 7.2

 yum-config-manager --enable remi-php72  

Got the info from here:
https://www.tecmint.com/install-php-5-6-on-centos-7/

I've also followed this guide without any luck:
http://howtolamp.com/lamp/requirements/removing-php/

https://stackoverflow.com/questions/51006367/update-php-from-5-5-7-to-7-on-centos7

I tried installing the latest release…

sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Tried enabling the latest versiion without success
sudo yum-config-manager --enable remi-php72

I then tried to install PHP…

yum install php php-common php-cli php-mysql

The installation didn't work, and I been trying to uninstall PHP, without success.

root@main [~]# sudo yum remove php-cli modphp php-common Loaded plugins: fastestmirror No Match for argument: php-cli No Match for argument: modphp
No Match for argument: php-common
No Packages marked for removal
root@main [~]# yum remove php
Loaded plugins: fastestmirror
No Match for argument: php
No Packages marked for removal

root@main [~]# yum list installed php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • cpanel-addons-production-feed: 104.219.172.10
  • base: mirrors.linode.com
  • epel: mirror.prgmr.com
  • extras: mirrors.linode.com
  • ius: mirrors.kernel.org
  • remi-php56: mirrors.mediatemple.net
  • remi-php72: mirrors.mediatemple.net
  • remi-safe: mirrors.mediatemple.net
  • updates: mirrors.linode.com
    Error: No matching Packages to list

root@main [~]# yum remove remi-php56
Loaded plugins: fastestmirror
No Match for argument: remi-php56
No Packages marked for removal

root@main [~]# sudo yum remove remi-php56
Loaded plugins: fastestmirror
No Match for argument: remi-php56
No Packages marked for removal

root@main [~]# yum info php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • cpanel-addons-production-feed: 104.219.172.10
  • base: mirrors.linode.com
  • epel: mirror.prgmr.com
  • extras: mirrors.linode.com
  • ius: mirrors.kernel.org
  • remi-php56: mirrors.mediatemple.net
  • remi-php72: mirrors.mediatemple.net
  • remi-safe: mirrors.mediatemple.net
  • updates: mirrors.linode.com
    Error: No matching Packages to list

root@main [~]# yum list installed php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • cpanel-addons-production-feed: 104.219.172.10
  • base: mirrors.linode.com
  • epel: mirror.prgmr.com
  • extras: mirrors.linode.com
  • ius: mirrors.kernel.org
  • remi-php56: mirrors.mediatemple.net
  • remi-php72: mirrors.mediatemple.net
  • remi-safe: mirrors.mediatemple.net
  • updates: mirrors.linode.com
    Error: No matching Packages to list

root@main [~]# yum remove php php-cli php-common php-gd remi-php
Loaded plugins: fastestmirror
No Match for argument: php
No Match for argument: php-cli
No Match for argument: php-common
No Match for argument: php-gd
No Match for argument: remi-php
No Packages marked for removal

Any ideas on what I may be doing wrong?

2 Replies

I don't know for sure, but this site has a searchable list (I assume it's up to date) of packages for the popular Linux Distros. This might help. https://pkgs.org/

Try:

yum list installed | grep -i php
To list all installed packages that contains php and then remove them one by one using yum remove
OR try yum remove php* with the asterisk

For installation , if you have CentOS 7 try to use IUS repository rather than webatic. https://ius.io/GettingStarted/

And Use @LouWestin 's link to check for the correct package names

To see your php version type php -v in the terminal

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct