PHP installation problem

I recently have tried starting with a newer image:
bone-debian-9.2-iot-armhf-2017-10-10-4gb.img

on a rev C BeagleBoneBlack.

I have been trying to build it back to the same level as I had before, adding the PRU libraries, ntpdate, and socket. Now I find that the php files I have been using on the previous image no longer work.

I tried:
php -v
and get the following…

-bash: php: command not found

I tried to add php using:

sudo apt-get install php5-common libapache2-mod-php5 php5-cli

but I get:

Package libapache2-mod-php5 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

E: Package ‘php5-common’ has no installation candidate
E: Package ‘libapache2-mod-php5’ has no installation candidate
E: Package ‘php5-cli’ has no installation candidate

So I then tried

debian@beaglebone:/var/www/html$ sudo apt-get install php5.6
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘php5.6-json’ for regex ‘php5.6’
Note, selecting ‘php5.6-common’ for regex ‘php5.6’
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.

but php -v still does not work successfully.

If there is any advice I would be pleased to hear it.

Thanks in advance.
Alan

Just did a quick look on packages.debian.org… Debian 9 (aka "stretch")
seems to provide PHP v7:

https://packages.debian.org/stretch/php-cli (virtual package)
https://packages.debian.org/stretch/php7.0-cli (actual binary)

It lists both as being in the main "stretch" repository, as opposed to
being in "backports" or other repositories, so they *should* be directly
install-able.

Maybe try `apt-get install php7.0-cli`?
Did you try running `apt-get update` first?