installing PECL upload progress on ubuntu server

status report prompts to install PECL upload progress
adding extension=uploadprogress.so to php.ini
status report shows PECL upload progress is installed
PECL upload progress in action
APC upload progress in action

Some of Drupal's CCK modules such as filefield and imagefield have support for a neat Upload Progress meter.

You may have seen a message in the status report of your Drupal site saying something like... "Upload progress not enabled - Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (prefered) or to install APC."

APC is primarily a PHP accelerator (there are many others available, but APC is simple to install and will apparently be included in the core of PHP 6). It also offers some uploadprogress functionality.

The information filefield module pokes into the status report tells you how to enable this feature if you've already got APC enabled, but it also adds "it is recommended to use PECL uploadprogress, which supports more than one simultaneous upload." (see filefield.install)

Whether you're already using APC or not, it's very easy to install PECL upload progress on a ubuntu server (and no doubt on other platforms, once you've got PEAR / PECL installed successfully). Here's how:

Install PECL / PEAR

The php5-dev package is also recommended, as you'll need it to install most of the extensions from PECL.

mcdruid@some-server:~> sudo apt-get install php-pear php5-dev

Install Upload Progress

mcdruid@some-server:~> sudo pecl install uploadprogress
...lots of output as PECL downloads and compiles the extension...
Build process completed successfully
Installing '/usr/lib/php5/20060613+lfs/uploadprogress.so'
install ok: channel://pecl.php.net/uploadprogress-1.0.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=uploadprogress.so" to php.ini

...then simply follow that last instruction (which I've emphasised); I put the line near the file upload section of my php.ini, but you could put it anywhere. This is where I'd expect to find the php.ini file on a server running a recent version of ubuntu:

/etc/php5/apache2/php.ini

The change will not show up until you restart apache (a force-reload doesn't cut the mustard for this sort of change):

mcdruid@some-server:~> sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                           [OK]

You should now have a nice reassuring message on the status report saying PECL upload progress is enabled, and next time you upload to a filefield or imagefield you should see a smart new progress meter.