how install or enabled php-zip and php-xml

October 23, 2019 1.4k views
PHP Apache

i have my droplet with ubuntu 18.10 and php 5.6. I need install php-zip and php-xml, when i run apt-get install php-zip or apt-get install php-xml, i get “php-zip is already installed” but php -m dont show. If enable extension=zip.so i get “unable to load library”. How i get php-zip an php-xml? thanks.

1 Answer

Hi @arcano162a0753f8ba1074e549,

You can install the php extensions like the following

sudo apt-get install php5.6-zip php5.6-xml

In fact you can install any PHP extension using the command above.

Please make sure you’ve ran

sudo apt-get update
sudo apt-get upgrade

Beforehand.

Regards,
KDSys

  • This options aren’t availables.
    When i run apt-get install php5.6-zip php5.6-xml the response is: Unable to locate package php5.6-zip and when i run apt-get install php-zip the response is: php-zip is already the newest version. But no is visible in php -m and software not found.
    Apparently is installed a php7.3 version not php5.6 version, but php5.6 not found

    Thanks you

    • Hi @arcano162a0753f8ba1074e549,

      You might have multiple PHP installations available.

      Can you please first type in

      php -v
      

      In your terminal to see which php version are you using.

      Then please enter the following

      whereis php
      

      This will show you all the directories where php will be found.

      Regards,
      KDSys

      • Thanks for your response.

        php -v
        

        PHP 5.6.40-5+ubuntu18.10.1+deb.sury.org+1 (cli) and

        whereis php
        
        php: /usr/bin/php /usr/bin/php5.6 /usr/lib/php /etc/php /usr/share/php7.3-common /usr/share/php7.3-mbstring /usr/share/php7.3-mysql /usr/share/php5.6-mysql /usr/share/php7.3-bz2 /usr/share/php5.6-mbstring /usr/share/php7.3-zip /usr/share/php7.3-gd /usr/share/php7.2-zip /usr/share/php5.6-gd /usr/share/php /usr/share/php5.6-common /usr/share/php5.6-readline /usr/share/php5.6-mcrypt /usr/share/php7.2-common /usr/share/php7.3-xml /usr/share/php7.3-curl /usr/share/php5.6-opcache /usr/share/php5.6-json /usr/share/man/man1/php.1.gz
        

        what should I do ?

        • Hi @arcano162a0753f8ba1074e549,

          This seems very odd and you indeed seem to have two PHP versions.

          Supposedly /usr/bin/php and /usr/bin/php5.6 should be the same thing but if you try

          /usr/bin/php5.6 -m | grep zip
          

          Does the extension actually appear?

          Usually, the following works

          sudo apt-get install php-zip
          

          or

          sudo apt-get install php5.6-zip
          

          Unless you’ve been checking the wrong php version from the command line and the extension is indeed there.

          Regards,
          KDSys

          • Thanks you.
            /usr/bin/php5.6 -m | grep zip get: empty.
            sudo apt-get install php-zip get: php-zip is already the newest version (1:7.2+62).
            sudo apt-get install php5.6-zip get: Unable to locate package php5.6-zip

Have another answer? Share your knowledge.