Question

Why I can't install php5 modules on Ubuntu 16.04?

Hello,

I have just finished setting up my Ubuntu 16.4 server. I have installed php5.6.26 because I am going to use Wordpress and I am not sure if all plugins are compatible with php7.

I need to install some php modules like php-xmlrpc or another module. When I type

sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc

This command is from this article on DO [How To Install WordPress with LAMP on Ubuntu 16.04] https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04 I get this message

 sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-gd is already the newest version (1:7.0+44+deb.sury.org~xenial+1).
The following additional packages will be installed:
  libcurl3 libxmlrpc-epi0 php7.0-curl php7.0-mbstring php7.0-mcrypt php7.0-xml php7.0-xmlrpc
The following NEW packages will be installed:
  libcurl3 libxmlrpc-epi0 php-curl php-mbstring php-mcrypt php-xml php-xmlrpc php7.0-curl php7.0-mbstring
  php7.0-mcrypt php7.0-xml php7.0-xmlrpc
0 upgraded, 12 newly installed, 0 to remove and 11 not upgraded.
Need to get 869 kB of archives.
After this operation, 2,943 kB of additional disk space will be used.
Do you want to continue? [Y/n]

Honestly I don’t want to use php7 and I have already explained why. How can I install the modules of php5, not php7?

What is the difference between modules for php7 and for php5? Can I still use php5 while the modules are for php7?

Thank you very much :)


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

As of Ubuntu 16.04.x default PHP version is PHP7. You should add PHP5 repository and you will be able to install it.

First of all add repository :

  1. sudo add-apt-repository ppa:ondrej/php

When it finishes update apt:

  1. sudo apt-get update

After that executing

  1. sudo apt-get install php5.6

You can also install any php package, but you need to refer as php5.6 instead of php, e.g. php5.6-mbstring instead of php-mbstring.

Also note: remove all php7 packages

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I have 404 error on ppa:ondrej/php ppa. Is it some other way to install php5.5 on ubuntu 16…04?