I try to uninstall PHP CLI because I am running it with version 7.3.7 while I run the normal PHP with 7.2.5

I tried apt-get purge php but this only removed the normal PHP not the CLI php.

How can I uninstall the PHP CLI or change the version?

Output of uname -a:

Linux linuxphp7 4.12.14-lp150.12.67-default #1 SMP Tue Jul 9 08:18:26 UTC 2019 (b610084) x86_64 x86_64 x86_64 GNU/Linux
  • 1
    opensuse does not use apt. Try yum or zypper. Commented Jul 30, 2019 at 10:57
  • @GeraldSchneider, apt works though, e.g. apt-get install xy
    – Black
    Commented Jul 30, 2019 at 10:59
  • 1
    On debian based distributions (which use apt) the package is usually named php-cli. On a Frankenlinux with mixed pacakge systems ... who knows. Commented Jul 30, 2019 at 11:03

1 Answer 1


Check which binary in use and then search for the rpm

which php
rpm -qa|grep php

Then check the version (php -v). After that delete that version if that is the one you want to get rid off.

  • Output of which php is : /usr/local/bin/php. Output of rpm -qa | grep php is empty. Output of php -v is PHP 7.3.7
    – Black
    Commented Jul 30, 2019 at 11:03
  • ok. this is good. so maybe you have installed it manually, outside of a package manager? is there a symlink in /usr/bin/php pointing to /usr/local/bin/php? Commented Jul 30, 2019 at 12:19
  • I deleted /usr/local/bin/php now php -v shows nothing. Then I installed php again with zypper in php7 php7-mysql and now it shows php 7.2.5. Thx!
    – Black
    Commented Jul 30, 2019 at 12:20

Not the answer you're looking for? Browse other questions tagged .