Can't install php5

Hi there, I can’t install php5 on Mate 16.04 raspberry pi.

doing apt-get install php5 I get told that …

E: Package ‘php5’ has no installation candidate

sudo apt-cache search php5 only gives...
php-auth - Creating an authentication system
php-doc - Documentation for PHP5
php-letodms-lucene - Document management system - Fulltext search
php-memcache - memcache extension module for PHP5
php-memcached - memcached extension module for PHP5, uses libmemcached
phpunit - Unit testing suite for PHP5
bluefish - advanced Gtk+ text editor for web and software development
phing - PHP5 project build system based on Apache Ant
php-http-request2 - Provides an easy way to perform HTTP requests
php-net-dns2 - PHP5 Resolver library used to communicate with a DNS server

Doing sudo apt-get update gives
Hit:1 http://ppa.launchpad.net/flexiondotorg/minecraft/ubuntu xenial InRelease
Hit:2 http://ports.ubuntu.com xenial InRelease
Hit:3 http://ppa.launchpad.net/ubuntu-mate-dev/welcome/ubuntu xenial InRelease
Hit:4 http://ports.ubuntu.com xenial-updates InRelease                  
Hit:5 http://ppa.launchpad.net/ubuntu-pi-flavour-makers/ppa/ubuntu xenial InRelease
Hit:6 http://ports.ubuntu.com xenial-security InRelease
Hit:7 http://ports.ubuntu.com xenial-backports InRelease
Hit:8 http://ports.ubuntu.com/ubuntu-ports xenial InRelease
Hit:9 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease
Reading package lists... Done                      

which does not seem like as many hits as I would expect, given I have turned on almost everything in the Software Packages section of the mate config.

Searching with google didn’t find a great deal that was helpful.

Anyone know what might be the problem

16.04 has php7, not php5

3 Likes

Oops, thanks … note to self, don’t follow old tutorials

1 Like

I’m having the same issue that I cannot install PHP5. Here the transcript:

pi@pibox:~/ $ sudo apt-get install nginx php5-cli php5-fpm php5-gd php5-mcrypt php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-fpm is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  php7.0-cli

Package php5-mcrypt is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Package 'php5-cli' has no installation candidate
E: Package 'php5-fpm' has no installation candidate
E: Package 'php5-gd' has no installation candidate
E: Package 'php5-mcrypt' has no installation candidate
E: Unable to locate package php5-curl

How can I still force installing PHP5? Do I need to add other repositories?

My question is: why would you want to? PHP 7 was released in Dec 2015. PHP 5 won’t be receiving any bug fixes any more, only security updates. Just replace php5-* with php7.0-* in your install command and you’re good to go:

sudo apt-get install nginx php7.0-cli php7.0-fpm php7.0-gd php7.0-mcrypt php7.0-curl

There is no ncurses.so for PHP-7 is one good reason. I’d expunge PHP-7 and install PHP-5 in a second just to get a working ncurses.so