Nov/092
How to upgrade PHP in Ubuntu
I decided to upgrade my PHP version as part of my Moodle 2.0 install. It wasn’t easy. Here’s the answer:
Step 1 – Update and Upgrade your existing software repositories
sudo apt-get update
sudo apt-get upgrade
Step 2 – Add some extra repositories so you can get the latest version
sudo nano /etc/apt/sources.list
Then add the following to that file, and save it:
deb http://http.us.debian.org/debian stable all
deb http://security.debian.org/ stable/updates main contrib
deb http://packages.dotdeb.org/ stable all
Step 3: Update your new repositories
sudo apt-get update
(I got some 404 errors with this step, but you can ignore them)
Step 4: Install the latest version of php
sudo apt-get install php5-cli
Step 5: Restart Apache
sudo /etc/init.d/apache2 restart
Nov/090
Install Moodle 2.0 on PHP 5.2.0 or higher
While installing Moodle 2.0, I ran into a little problem. It says that it requires a minimum PHP version of 5.2.8 – but I was running 5.2.6. Updating PHP in Ubuntu is a pain in the bum, so instead, I used this little hack.
A quick look at the source for install.php reveals this on line 489:
$version_fail = (version_compare(phpversion(), “5.2.8″) < 0);
If you just change 5.2.8 to your version (in my case, 5.2.6), it will install. There aren’t heaps of changes between these two versions, so I’m hoping there won’t be any major side effects!