3

I have a Raspberry Pi 2 where I want to run my backend for an application on. This needs php 5.6 to run correctly, otherwise it will just not work. I installed PHP 5.6 on this Raspberry Pi, but now I have the problem that when I do php -v on the Command Line it will say PHP 5.6.13 (cli) (built: Dec 1 2015 09:39:07).

When I do phpinfo() it will give me PHP Version 5.4.45-0+deb7u2 (and also 5.4 for all other php-related plugins/libraries/extensions, no '5.6' is found on that page.

I tried to completely install php 5.6 from scratch, but that also didn't fix the problem.

For my backend to run the apache needs PHP 5.6. I hope someone knows how to solve this problem and can help me with that.

2

You don't specify what version of Raspbian you are running, however, Raspbian Jessie shows PHP 5.6.14 available via apt-get. I used the following command to determine this:

sudo apt-cache policy php5

It can be installed with the following command

sudo apt-get -y install php5 libapache2-mod-php5

To make Apache recognize the updated version you will need to restart Apache:

sudo service apache2 restart

You can test this with the same phpinfo(); command you used before.

  • I will install Jessie and then try what you said. Right now it is running Wheezy. – JeroenJK Jan 5 '16 at 9:15
  • Your solution seems to be working. Both the Command Line and phpinfo() show 5.6.14-0+deb8u1. Now I can finally continue setting up my backend. Thanks! – JeroenJK Jan 5 '16 at 9:47
0

You have the problem that you have two different versions installed and the one you want to use is not the one that is being selected. A quick search brought up the SE Q&A: is there a tool to manage multiple installations of php on one machine There are several answers including phpbrew but it isn't clear to me - a non-PHP user - which, if any will suite your circumstances, one simple bash script that I looked at seemed possibly of use for the RPi. It was php-switch on Github.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.