Sunday, April 17, 2011

up2date PHP5.3 packages for Ubuntu

Most Linux distributions have a policy of not being to up to date with upstream releases of software, mostly for good reasons. This however is extremely painful for developers, as it means they often need to use really outdated version, containing all sorts of bugs - and even missing features.

This has been pissing me off for quite some time, so I have been running my own PHP builds for a while - but when it comes to deploying the apps... the sysadmins obviously start complaining that they have to invest a lot more work into maintaining the servers then they otherwise would have to.
So.. What can we do about that? Launchpad to the rescue!

Launchpad makes it really easy to provide your own custom packages, and even has a vast build farm to build packages automatically for different architectures and different Ubuntu releases. The only down side is it doesn't build rpm packages.. Thats fine by me, but that would be really useful for those wishing to deploy on a RedHat based distro.

After hunting down the debian PHP packaging repo, I forked it onto github (as php5-vanilla-ubuntu) and started ripping out some of their weird patches and enabled mysqlnd, but otherwise keeping their package splitting and the things you would expect from a debian package.



What does this mean?
- Well, if you are looking for up2date PHP packages (currently PHP5.3.6) to work with, checkout the PHP5.3 PPA on launchpad :)
This PPA works just fine as a drop-in-replacement for the default Ubuntu packages, and provides builds for Lucid and Maverick (there are some changes in Natty I need to look into..).

I have been running these packages for some time now, but if you notice any issues - please let me know :)

21 comments:

  1. you could use the packages from dotdeb.org if you wouldn't mind the suhosin in it. :)

    Tyrael

    ReplyDelete
  2. Good point Tyrael. I did at some point use dotdeb for PHP packages, but I stopped that long time ago - and I can't say I remember the reason... :)

    Running without Suhosin, and having mysqlnd enabled is however pretty good reason to create new packages :)

    ReplyDelete
  3. For openSUSE (or SUSE Linux enterprise users) one could use the buildservice repos:
    http://software.opensuse.org/search?baseproject=ALL&exclude_debug=true&lang=nl&p=1&q=%22php5%22

    The buildservice is also able to provide Ubuntu packages.

    ReplyDelete
  4. Good to know this ppa. You could also provide a gd extension compiled against the bundled package (see http://cumu.li/2008/5/13/recompiling-php5-with-bundled-support-for-gd-on-ubuntu to get what I mean). The one coming from ubuntu lacks lots os functions found on the bundle gd.

    ReplyDelete
  5. @David: the php core devs doesn't like suhosin for some reason.

    @bjori: dotdeb ships vanila php packages except the suhosin stuff, so for example it comes with mysqlnd:

    tyrael@devel-tyrael:~$ php -i|grep mysqlnd
    Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $
    Client API library version => mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $
    mysqlnd
    mysqlnd => enabled
    Version => mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $
    Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $

    Tyrael

    ReplyDelete
  6. Hmh.. Did not know that Tyrael. I'll have to checkout dotdeb again :]

    Marcio: I was under the impression this was already fixed? imagerotate() atleast works fine for me.. and libgd should be in sync with the PHP "fork" for quite some time.

    ReplyDelete
  7. I don't know details, but the mainstream php lacks, at least, the imageantialias() function (http://php.net/manual/en/function.imageantialias.php). I know that because if I forget to hold my own compiled package, I get this error on my graphs when php gets updated from canonical. :)

    ReplyDelete
  8. Hah. It is missing indeed.
    I'll see if I can build against the bundled lib tomorrow morning :)

    ReplyDelete
  9. I'll be your faithful customer then. :)
    Thanks a lot!
    Regarding the Suhosin patch, I still don't get the point. If it is for improved security, why not?

    ReplyDelete
  10. @bjori. I upgraded via the ppa, but I'm now getting:
    PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/pdo_sqlite.so' - /usr/lib/php5/20090626/pdo_sqlite.so: undefined symbol: sqlite3_column_text in Unknown on line 0

    ReplyDelete
  11. @David; Hmh. Weird. Both SQLite and SQLite3 load fine.. I'll check it out

    ReplyDelete
  12. @David: Fixed :)
    bjori@jessica:~$ php -m | grep -i sqlite
    pdo_sqlite
    SQLite
    sqlite3


    @Marcio: Fixed :)
    bjori@jessica:~$ php --rf imageantialias
    Function [ function imageantialias ] {

    - Parameters [2] {
    Parameter #0 [ $im ]
    Parameter #1 [ $on ]
    }
    }

    ReplyDelete
  13. @bjori: Brilliant! All good. Had some trouble with phpmyadmin, but got it working by swapping to a socket connection. Not sure what went wrong there…

    ReplyDelete
  14. pretty cool and with uptodate Firebird drivers (pdo included)

    I will test it on my machine (natty)

    ReplyDelete
  15. Hmm, I still can't connect to mysql unless I specify a socket. Is that normal? What about if I want to connect to a remote host? Shouldn't the default socket be /var/run/mysqld/mysqld.sock instead of /tmp/mysql.sock?

    ReplyDelete
  16. Ah, helps if you RTFM. MySQL treats localhost as special and will connect via the socket unless the protocol is specifically set to TCP, or you use 127.0.0.1 instead.
    http://dev.mysql.com/doc/refman/5.1/en/connecting.html

    ReplyDelete
  17. @bjori. while installing php5.3.6 on lucid 10.04.2, I got this:

    The following packages have unmet dependencies:
    php5-fpm: PreDepends: dpkg (>= 1.15.7.2) but 1.15.5.6ubuntu4.5 is to be installed

    I have been upgraded. It seems newest dpkg version is 1.15.5.6 on lucid.

    ReplyDelete
  18. @David ;) Glad you resolved it.
    Also note: There are minor subtle differences between mysqlnd and libmysql. I highly recommend atleast skimming through the docs at http://no.php.net/mysqlnd

    @silverfox: hmh.. So the installation did work regardless of the error?
    I'll need to look into that one.. If you have any more info, please send me an email: hannes.magnusson@gmail.com

    ReplyDelete
  19. Nice! This is totally useful. It would be great if mysqlnd would be adopted by the Ubuntu package mantainers. Till then, muchos gracias!

    ReplyDelete
  20. Any chance of getting a 64 Bit PHP 5.3.8 version built on your site?

    ReplyDelete