Ubuntu packages for latest PHP snapshots
It was my great pleasure to find (some time ago) that, starting with version 5.3.0, PHP supports namespaces (among many other things). Even more exciting is that starting with version 6 it also supports Unicode natively. How awesome is that!!!
However there is a slight problem: these versions are only snapshots at the present time so there are no binary packages provided for them by our beloved Linux distributions and since I really don’t like messing up my beautiful Ubuntu Hardy installation with (uninstallable) source compilations I couldn’t make use of PHP’s new features. This is where CheckInstall comes in to the rescue…
Edit: There now exists a set of pre-built .deb packages for Debian and Ubuntu here, thanks to Void.
1. Get checkinstall.
sudo apt-get install checkinstall
2. Get PHP. Visit http://snaps.php.net/ and choose the version you like (I chose 5.3 here):
wget http://snaps.php.net/php5.3-200805060630.tar.gz tar -zxf php5.3-200805060630.tar.gz
3. Compile PHP. DO NOT CALL “make install”!
cd php5.3-200805060630 ./configure --prefix=/usr --with-pdo-pgsql make
The part after “./configure --prefix=/usr” is really up to you, I just chose to add PDO PgSQL here (otherwise the default extensions are quite complete). Anyway, if you find that you need something extra you can recreate the package anytime with the newly needed options using these same steps (nothing gets messed up!).
Please note that depending on your options and installed system, you will most likely need to install some prerequisites for the ./configure to properly succeed (e.g. libxml2-dev). Just look at the ./configure output and use Synaptic to install whatever is needed. If you have problems with this bit just post a comment here and I’ll help.
One trick to use here if you have a multi-core system is to call “make -j2″ instead of the plain “make” above so that your compilation will make use of all the CPU power available and thus running much faster (or “make -j4″ if you have 4 cores and so on… - see this post on how to get the CPU count).
4. Run tests. This step is entirely optional but I strongly recommend you do it and at the end, if failed tests are discovered, say Yes to automatically send the report to the PHP QA team. This is such an easy way of providing real help to PHP developers in their endeavors.
make test
5. Run CheckInstall (it will run “make install” for you internally)! It will ask you some questions which, if you don’t understand you can just skip without any worries (just press Enter everywhere).
sudo checkinstall --fstrans=no
The “--fstrans=no” option is usually needed only on Ubuntu Hardy (maybe on others too).
6. That’s it! You will now find a brand new DEB package in the PHP source directory which by the way, is already installed (just store it somewhere if you want). If you will want to uninstall this package (who know for what reason - maybe when the linux distro will provide this version by default and you will want to use that instead) then you will be able to do all you want with it in Synaptic (under “Installed (local or obsolete)” - mine is called php5.3).
Enjoy!
Enjoyed this post?, why not subscribe to the RSS feed!
May 19th, 2008 at 1:43 pm
Hi :)
I’ve already install PHP5.3 from snap and got a question:
from CLI (php -v) i’ve got “PHP 5.3.0-dev (cli)” but how i can apply this version fon Apache?
Am I must use PHP as CGI?
Thx and sorry for my english :-[
Regards, Alexey
July 20th, 2008 at 1:02 pm
Hi Alexey,
just take some other compile options into your configure. In your case take the --with-apxs2=/usr/bin/apxs2 option into the configure. Remember to install with apt-get install apache2-threaded-dev (for the prefork version) first. Otherwise you wont have apxs2 installed anyway.
Regards,
Mario
August 3rd, 2008 at 8:52 pm
Hi,
I have installed everything, but cannot apply it to Lighttpd.
How can I apply this to Lighttpd? (With fcgi?)
Thanks!
February 21st, 2009 at 7:15 pm
Anzahl der Prozessoren unter Linux auslesen…
cat, grep und wc - Shell Befehle kombiniertBei dem Versuch php5.3 auf meinem Laptop zu installieren, bin ich über Paloş::Code.Blog() gestolpert. Die Kombination d…
April 6th, 2009 at 12:22 am
I’ve made some “home made” packages for Intrepid and Jaunty for the RC1. You may want to test them (they have some problems, so be warned ;-)). Here they are: http://tekla.art.pl/php-5.3-debian-ubuntu/
April 6th, 2009 at 12:44 am
@Void: Very nice work, I always looked forward to the idea of having a repository with unstable (very new) packages of PHP (and a few other programs actually), so this is *very* welcome indeed.
You should definitely keep this up, I think other will be very glad to use these!
April 6th, 2009 at 2:00 pm
@Valeriu: many thanks for the nice words :-). my builds are rather for those impatient (like me :-). The .debs are based on builds provided by Guillaume Plessis (http://www.dotdeb.org/) - he provides a really nice, fresh, stable LAMP stack on his site/repos and he is going to publish 5.3.0 builds too, when final version of PHP 5.3 is released. So, visit his site frequently!
July 1st, 2009 at 7:41 pm
I had a problem with configuring PHP 5.3.0 final release (30.6.2009) on debian/lenny. I got this:
“checking for pg_config… not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path”
So I also needed to install (DEBIAN):
apt-get install libpq-dev.
After that configuring worked.
July 5th, 2009 at 11:09 pm
[…] да си обновя PHP парсъра до версията 5.3, но с помощта на тази статия се справих. Общо взето мога да кажа, че съм […]
October 5th, 2009 at 1:19 am
I get as far as checkinstall. Then I get this fatal error:
trying to overwrite `/usr/bin/pear’, which is also in package php-pear
subprocess paste killed by signal Broken pipe
I’m running the latest ubuntu, upgrading to PHP 5.3. Help! :D
October 8th, 2009 at 4:06 pm
hey master uninstall your existing php packages first!
November 8th, 2009 at 4:38 pm
hey all,
While Makeing i’m getting many errors like
”
/home/enova/Downloads/php-5.3.0/ext/mysqli/mysqli_api.c:568: undefined reference to `executor_globals_id’
”
how should i progress next?
February 5th, 2010 at 1:45 pm
[…] Hilfe bei Brandon Savage und Palos […]