PHP 5.3 on Ubuntu – Configuration

I’ve been testing PHP 5.3 on various Ubuntu machines for the last few months (since around the time of my first post). I’m now running it on a production server for 1 site.

I noticed I have been getting a lot of hits on my previous post, mainly from others looking for ways to install PHP 5.3 on Ubuntu so I thought it was about time for a follow up.

I’m using PHP 5.3.0 as this is the latest release for Zend Server, the only 5.3.1 release I’m aware of is the DotDeb packages. I try to stay clear of DotDeb, mainly because the packages are built for Debian which often causes issues and conflicts. (Ubuntu is based on Debian unstable so can potentially have a completely different version of every package than the Debian stable branch, as well as changes/tweaks/updates from the Ubuntu team.)

Here are the tweaks I have made to enable PHP to run smoothly, it’s generally quicker to use the Zend web GUI, but these changes can also be done by editing php.ini or adding/removing symbolic links to extensions:

Config changes:

  • Set the default timezone. This seams to be a requirement for PHP 5.3 to have the local timezone set, otherwise we are spammed with about 20 deprecated message when PHP starts. There are a number of ways to do this, the easiest of which is to set the date.timezone config parameter.
  • Set the full path to sendmail. The PHP mail() command will fail unless this is done, this is due to a bug in either PHP or Zend Server (which of them, I’m not sure). Set the sendmail_path config parameter to do this.
  • [Optional] By default the maximum file size you can upload is around 8Mb, if you are likely be using larger files than this, video uploads for example, this change becomes essential. There are 2 options for this setting, both post_max_size and upload_max_filesize should be set.
  • [Optional] By default session timeouts are very short (only about 20 mins), I find it’s usualy a good idea to make it longer.

Extension changes:

  • By default Zend Server comes with tonnes of database extensions, MySQL, PostGreSQL, MSSQL, ODBC, OCI8, SQLite plus PDO versions of most of the above. There is no point having extensions in there we don’t need, pick the extension(s) you need and disable the rest.
  • Disable pcntl on web server environments, as it is apparently not supposed to be used in this way.

This is really all is need to get things up and running, shouldn’t take more than a minute to do.


Leave a Reply