how install or enabled php-zip and php-xml

Posted October 23, 2019 33.8k views

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 i get “unable to load library”. How i get php-zip an php-xml? thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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



  • 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.


      • Thanks for your response.

        php -v

        PHP (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


          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.