0

I followed the steps here: Update server php version to 5.4.10 via the command line

and finally I get the message that it is the newest version, but it is version 5.36, far from the newest version.

I want to upgrade to at least php version 5.37 so my Laravel framework works good, and there is a much newer version of php released already:

http://php.net/archive/2014.php#id2014-01-10-1

Can you help me to upgrade php5?

Jesse C
  • 28
  • 3
Darius.V
  • 287
  • 2
  • 5
  • 14

3 Answers3

0

I have php5 5.5.8 on my Trusty Ubuntu, so you have to upgrade your ubuntu to a newer version to get a more recent php5. Edit /etc/apt/sources.list, replace the version with a newer one (like trusty or saucy), and apt-get upgrade will bring you the most recent one.

Ron
  • 20,518
  • 6
  • 57
  • 72
  • I wouldn't recommend doing this on a production-level machine though. Trusty isn't released (or supported) yet. – Oli Jan 22 '14 at 15:32
  • Right, I forgot to mention that. So Saucy will be sufficient, or a recent LTS version, right? – wangguoqin1001 Jan 22 '14 at 15:37
  • Yeah, Saucy has 5.5.3. The last LTS (12.04) is sticking with 5.3.* (it still gets security updates but they won't do a major upgrade to avoid breaking deployments). – Oli Jan 22 '14 at 15:40
0

As you'll be able to see from the php5-oldstable PPA page the current version in there is 5.4.23. If you're not seeing that:

  • You either haven't followed that post correctly (have you run an apt-get update? did you add the repo properly?) Double check.
  • You're not running a supported version of Ubuntu. The PPA caters to Lucid, Precise, Quantal and Raring. Not Saucy. If you PHP5 for a different version of Ubuntu, check the Ondřej Surý's main PHP5 PPA.
Oli
  • 289,791
  • 117
  • 680
  • 835
  • tried several times. Consuled my coworker who is more experienced than me with linux. We did not find quick solution, so just will move to anohter server with newer version of ubuntu and php. In that server it was 11.04. – Darius.V Jan 23 '14 at 14:05
  • Ooo-err, yes you probably don't want anything pre-12.04 in production because most things aren't getting updates any more. – Oli Jan 23 '14 at 14:17
0

Get the latest stable release of PHP:

Open a terminal(Ctrl+Alt+t) and cd to the directory where you downloaded the tar ball and then type:

tar -zxvf php-5.5.8.tar.gz

After the extraction has completed, type

cd php-5.5.8
./configure
make
sudo make install

Log out and log in to reload all packages that depend on PHP and you will have PHP version 5.5.8!

For a detailed instruction manual, refer to the INSTALL file in the extracted directory and scroll down to Installation on Unix systems.


Before updating, when I did php --version, I got:

PHP 5.4.6-1ubuntu1.5 (cli) (built: Dec 12 2013 04:39:44) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

After updating, php --version gives me:

PHP 5.5.8 (cli) (built: Jan 22 2014 21:12:05) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
jobin
  • 27,142
  • 16
  • 100
  • 116
  • This way looks good, I ran make command, and then there was writen dont forget to run make test. So I ran it and now I see FAILED TEST SUMMARY "Test fileperms() & chmod() functions: usage variation - misc. perms [ext/standard/tests/file/006_variation2.phpt] chmod() basic functionality [ext/standard/tests/file/chmod_basic.phpt] Test disk_free_space and its alias diskfreespace() functions : basic functionality [ext/standard/tests/file/disk_free_space_basic.phpt] Test filetype() function: Check character type [ext/standard/tests/file/filetype_variation2.phpt] " – Darius.V Jan 23 '14 at 07:14
  • Then I still tried tu run sudo make install, and not errors where showed but php --version still shows 5.36 – Darius.V Jan 23 '14 at 07:20
  • oh, actually forgot logout and login and when I openened another putty - it shows 5.5.8 :) but I am not sure if it will work good when there was errors in make test? – Darius.V Jan 23 '14 at 07:31
  • btw when I run it from browser it worsk still as 5.3.6, but when I run in command line, it works as 5.5.8. How to fix that? Have restarted apache – Darius.V Jan 23 '14 at 07:50
  • check your Apache and command line have same PHP and if both using the same php.ini file. – jobin Jan 23 '14 at 07:58
  • I believe they are not using same php.ini as my coworker said. So I have to edit somehow php.ini? – Darius.V Jan 23 '14 at 07:59
  • I am right now out of reach of my laptop, I'll let you know what exactly to do, in the mean time you can google! – jobin Jan 23 '14 at 08:02
  • We just took new server on digital ocean for 5 $ /month with enough version for laravel and thats it :) thanks for help – Darius.V Jan 23 '14 at 14:08