Change PHP5 to PHP7 - How do i remove php5?

Discussion in 'Server Operation' started by MB.n, Nov 8, 2016.

  1. MB.n

    MB.n New Member

    Hey guys,

    today I installed php7 to test my webserver with it if anything is working - and all is working fine.

    Now I want to remove php5 complete - i looked for all packages with:
    dpkg -l | grep php

    The output give me all these:
    ii  libapache2-mod-php5                  5.6.27+dfsg-0+deb8u1          amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    ii  php-auth                             1.6.4-1                       all          Creating an authentication system
    ii  php-auth-sasl                        1.0.6-1+deb8u1                all          Abstraction of various SASL mechanism responses
    ii  php-common                           1:42-1~dotdeb+8.1             all          Common files for PHP packages
    ii  php-db                               1.7.14-3                      all          PHP PEAR Database Abstraction Layer
    ii  php-gettext                          1.0.11-1                      all          read gettext MO files directly, without requiring anything other than PHP
    ii  php-http-request                     1.4.4-4                       all          PEAR class to provide an easy way to perform HTTP requests
    ii  php-log                              1.12.8-2                      all          Logging Framework
    ii  php-mail                             1.2.0-7                       all          Class that provides multiple interfaces for sending emails
    ii  php-mail-mime                        1.8.9-1+deb8u1                all          PHP PEAR module for creating MIME messages
    ii  php-mdb2                             2.5.0b5-1                     all          merge of the PEAR DB and Metabase php database abstraction layers
    ii  php-net-dime                         1.0.2-2                       all          class that implements DIME encoding
    ii  php-net-sieve                        1.3.2-4                       all          Handles talking to a sieve server
    ii  php-net-smtp                         1.6.2-2                       all          PHP PEAR module implementing SMTP protocol
    ii  php-net-socket                       1.0.14-1                      all          PHP PEAR Network Socket Interface module
    ii  php-net-url                          1.0.15-3                      all          easy parsing of Urls
    ii  php-patchwork-utf8                   1.1.25-1                      all          UTF-8 strings handling for PHP
    ii  php-pear                             1:1.10.1+submodules+notgz-8.1 all          PEAR Base System
    ii  php-soap                             1:7.0+42-1~dotdeb+8.1         all          SOAP module for PHP [default]
    ii  php-tcpdf                            6.0.093+dfsg-1                all          PHP class for generating PDF files on-the-fly
    ii  php5                                 5.6.27+dfsg-0+deb8u1          all          server-side, HTML-embedded scripting language (metapackage)
    ii  php5-cgi                             5.6.27+dfsg-0+deb8u1          amd64        server-side, HTML-embedded scripting language (CGI binary)
    ii  php5-cli                             5.6.27+dfsg-0+deb8u1          amd64        command-line interpreter for the php5 scripting language
    ii  php5-common                          5.6.27+dfsg-0+deb8u1          amd64        Common files for packages built from the php5 source
    ii  php5-curl                            5.6.27+dfsg-0+deb8u1          amd64        CURL module for php5
    ii  php5-fpm                             5.6.27+dfsg-0+deb8u1          amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
    ii  php5-gd                              5.6.27+dfsg-0+deb8u1          amd64        GD module for php5
    ii  php5-imagick                         3.2.0~rc1-1                   amd64        Provides a wrapper to the ImageMagick library
    ii  php5-imap                            5.6.27+dfsg-0+deb8u1          amd64        IMAP module for php5
    ii  php5-intl                            5.6.27+dfsg-0+deb8u1          amd64        internationalisation module for php5
    ii  php5-json                            1.3.6-1                       amd64        JSON module for php5
    ii  php5-mcrypt                          5.6.27+dfsg-0+deb8u1          amd64        MCrypt module for php5
    ii  php5-memcache                        3.0.8-5                       amd64        memcache extension module for PHP5
    ii  php5-memcached                       2.2.0-2                       amd64        memcached extension module for PHP5, uses libmemcached
    ii  php5-mysql                           5.6.27+dfsg-0+deb8u1          amd64        MySQL module for php5
    ii  php5-pspell                          5.6.27+dfsg-0+deb8u1          amd64        pspell module for php5
    ii  php5-readline                        5.6.27+dfsg-0+deb8u1          amd64        Readline module for php5
    ii  php5-recode                          5.6.27+dfsg-0+deb8u1          amd64        recode module for php5
    ii  php5-sqlite                          5.6.27+dfsg-0+deb8u1          amd64        SQLite module for php5
    ii  php5-tidy                            5.6.27+dfsg-0+deb8u1          amd64        tidy module for php5
    ii  php5-xcache                          3.2.0-1                       amd64        Fast, stable PHP opcode cacher
    ii  php5-xmlrpc
    ii  php5-xsl
    the bold writen should there packages, i need to purge for clean php5 purge or am i wrong?

    So i purge this packages with:
    apt-get purge php5 php5-cgi php5-cli php5-common php5-curl php5-fpm php5-gd php5-imagick php5-imap php5-intl php5-json php5-mcrypt php5-memcache php5-memcached php5-mysql php5-pspell php5-readline php5-recode php5-sqlite php5-tidy php5-xcache php5-xmlrpc php5-xsl

    But before i confirm with "y", i saw that its wanna remove the following packages:

    The following packages were automatically installed and are no longer required:
    dbconfig-common libjs-sphinxdoc libjs-underscore php-db php-http-request php-mdb2
    php-net-dime php-net-socket php-net-url php-tcpdf
    Use 'apt-get autoremove' to remove them.

    The following packages will be REMOVED:
    libapache2-mod-php5* php-auth* php-auth-sasl* php-gettext* php-log* php-mail*
    php-mail-mime* php-net-sieve* php-net-smtp* php-patchwork-utf8* php5* php5-cgi*
    php5-cli* php5-common* php5-curl* php5-fpm* php5-gd* php5-imagick* php5-imap*
    php5-intl* php5-json* php5-mcrypt* php5-memcache* php5-memcached* php5-mysql*
    php5-pspell* php5-readline* php5-recode* php5-sqlite* php5-tidy* php5-xcache*
    php5-xmlrpc* php5-xsl* phpmyadmin* roundcube* roundcube-core* roundcube-mysql*

    But i dont want to remove the following:
    phpmyadmin* roundcube* roundcube-core* roundcube-mysql* roundcube-plugins*

    And little question - why its wanna purge these:
    php-auth* php-auth-sasl* php-gettext* php-log* php-mail* php-mail-mime* php-net-sieve* php-net-smtp* php-patchwork-utf8*

    Their no longer needed?


    Hmh...dont changed anything..phpinfo() now says again its php5....any idea?
    Last edited: Nov 8, 2016
  2. MB.n

    MB.n New Member

    Nobody ? It would be enough when anybody can say me how to configure php7 as multi php version - i would activate it for all customers.
  3. lnxgs

    lnxgs Member

    If you run Nginx as webserver, you can add a different fastcgi_pass value to different virtual hosts.
    This parameter can be the PHP7 socket or the PHP5.6 socket.
    Es. for PHP7 fastcgi_pass unix:/run/php7.0-fpm.sock;
    for PHP5.6 fastcgi_pass unix:/run/php5-fpm.sock;

    In this way, you can specify which is the php version to be run.

  4. Heeter

    Heeter Member


    Just from personal experience about a month ago on a LAMP ubuntu 14.04 server, I highly recommend to not try removing php5. Just redirect everything to php7, but do not uninstall anything.


Share This Page