I suspect that my Ubuntu server contains abandon PHP files or packages which is not used. How can I do a clean install of latest PHP 5.6 in my server?

I ran this on my ubuntu server 'dpkg --get-selections | grep -v deinstall' and got this below.

php-common                                      install
php5                                            install
php5-cli                                        install
php5-common                                     install
php5-curl                                       install
php5-fpm                                        install
php5-gd                                         install
php5-intl                                       install
php5-json                                       install
php5-mcrypt                                     install
php5-mysqlnd                                    install
php5-readline                                   install
php5-tidy                                       install
php5-xmlrpc                                     install
php5-xsl                                        install
php5.6                                          install
php5.6-cli                                      install
php5.6-common                                   install
php5.6-fpm                                      install
php5.6-json                                     install
php5.6-mbstring                                 install
php5.6-mcrypt                                   install
php5.6-mysql                                    install
php5.6-opcache                                  install
php5.6-readline                                 install

It seem like there are several duplicated PHP files there.

Furthermore, on my phpmyadmin, I saw that I'm using an older PHP 5.6 version "PHP version: 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1"

However, when I run php -v, it shows this below:

PHP 5.6.24-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

This seems like my server is using different PHP version on different environment.

How can I remove the unwanted PHP files and use only the latest version of PHP 5.6? I'm not able to experiment it myself because it's a production server, I can't afford to make it down for more than 10-20 minutes.


The short answer is:

apt-get purge php5-common

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.