"Package 'php' is not installed, so not removed" but when i run the command "php -v" it works

53 views Asked by At

this is the output when i run the command

❯ sudo apt remove php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'php' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 387 not upgraded.
❯ php -v
PHP 8.2.15 (cli) (built: Jan 20 2024 14:17:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.15, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.15, Copyright (c), by Zend Technologies

my hardware specifications

         Chassis: laptop
Operating System: Linux Mint 21.2  
          Kernel: Linux 5.15.0-76-generic
    Architecture: x86-64
 Hardware Vendor: Dell Inc.
  Hardware Model: Latitude 7280

when I look at php in the /usr/bin dir

❯ ls /usr/bin | grep php
php
php8.1
php.default

Sorry i can't give the screenshot because i need 10 reputation. Thanks for the answer

2

There are 2 answers

0
Sachin Bahukhandi On BEST ANSWER

If you aren't sure of what version you're using at the moment and where all PHP has been installed you could easily use:

php --ini

To remove all at once:

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

Also, please visit for more details: https://askubuntu.com/a/187278

0
Anisur Rahman On

try with sudo apt remove php8.1

then sudo apt autoremove

and sudo apt autoclean