11

I'm actually stuck with a little problem. I want to use Laravel on my pi but it requires at least PHP 5.5.9.

But actually, the latest version of PHP that I am able to install (via the official repository) is the 5.4

How can I upgrade to 5.6 (or 5.5.9) ?

  • Looks like you will have to build it from source. – dhruvvyas90 Jun 21 '15 at 16:50
10

These are the steps you can follow.

  1. Grab latest source from this site. (http://php.net/downloads.php) Choose your nearest mirror. For example, I did "wget http://in1.php.net/distributions/php-5.6.10.tar.bz2"
  2. Unpack it: tar -xvjf php-5.6.10.tar.bz2
  3. cd php-5.6.10
  4. ./configure
  5. make -j4 (if you're compiling it on Rpi 2) else just make
  6. sudo make install
  7. Test it by firing php -v

It should be now upgraded to 5.6

Hope it helps.

  • Thank you for you post but for the very first time I'm not able to install it with this method. I don't know why but I think I've got a bug with the ./configure, it seems it does not work correctly because I am not able to use "make" (makefile is not created). Log file here – Germain Jun 21 '15 at 23:42
  • You will have to install related dependencies. See the error. Pi is missing libxml2. To install that, "sudo apt-get update && sudo apt-get install libxml2". Try configuring again. You may face other dependencies issues. You will have to install each on using "sudo apt-get install" before you can proceed with make. Hope it helps. – dhruvvyas90 Jun 22 '15 at 3:36
  • 1
    Try : sudo apt-get install libxml2-dev – dhruvvyas90 Jun 22 '15 at 18:31
  • 1
    Thank you very much it worked well and I was able to execute make & then install ;) – Germain Jun 22 '15 at 21:07
  • 1
    Locate old php.ini file by "sudo find / -name php.ini" and copy the new one from php-5.6 directory by "sudo cp php.ini-production /path/to/php.ini" That should do, I guess. – dhruvvyas90 Jun 23 '15 at 19:23
5

At the time of this writing (november 2015), raspbian is built on Debian Jessie. The installable PHP version is in the 5.6 branch.

However, for Laravel projects you will need a number of PHP extensions. Most of these are available in the Raspbian repositories (or out of the box), but the php_mbstring extension cannot be loaded via apt-get.

Instead, to get php5_mbstring run apt-get install libapache2-mod-php5 which includes it (reference comments in http://php.net/manual/en/mbstring.installation.php)

protected by Community Dec 3 '15 at 1:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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