Last updated August 7, 2012. Created by ericxb on February 26, 2011.
Edited by rbrownell. Log in to edit this page.

Shared hosting providers present greater difficulties because you don't have root. Instead you have to compile the extensions in your local directory and somehow entice php to load your files.

I don't have access to any other providers; but Dreamhost has made this fairly painless if you have some linux shell skills. http://wiki.dreamhost.com/PHP.ini is their general FAQ on the subject. Following is a brief recipe for specifically enabling pecl/uploadprogress:

  • Make sure you are using php 5.3. As of this writing, Dreamhost's default is to provide you a FCGI version of php 5.2. This can be changed to 5.3 in their control panel. (Manage domains --> edit --> PHP Mode --> choose 5.3.x CGI from the pop-up).
  • Disable mod_security. This can be also done in the Dreamhost control panel under the domain settings. (Manage domains --> edit --> Extra Web Security? --> clear (uncheck) the checkbox.)
  • Wait 5-10 Minutes
  • ssh into your home dir on the Dreamhost machine.
  • Change your PATH environment variable to include /usr/local/php53/bin ahead of /usr/local/bin (the php binaries installed in /usr/local/bin are 5.2). If you don't know how to change this, an inadequate explanation is to type:
    export PATH=/usr/local/php53/bin:$PATH
    into the default .bash_profile that Dreamhost provides. Log out and log back in. Type:
    echo $PATH
    to see what your PATH contains. Also type:
    which php
    to see which php you are executing. It should read: /usr/local/php53/bin/php
  • Download the source for uploadprogress from pecl into some directory you find convenient:
    wget http://pecl.php.net/get/uploadprogress -O uploadprogress-1.0.1.tgz
    (that's an uppercase oh, not a zero)
  • Extract the archive:
    tar -zxvf uploadprogress-1.0.1.tgz
  • Configure and compile:
    cd uploadprogress-1.0.1
    phpize
    ./configure --with-php-config=/usr/local/php53/bin/php-config
    make
    You should now find the compiled extension as ./modules/uploadprogress.so
  • Create a directory-tree at the root of your home directory: ~/.php/5.3
    mkdir ~/.php
    mkdir ~/.php/5.3
  • Copy the newly created extension into the .php tree:
    cp ./modules/uploadprogress.so ~/.php/5.3/
    You can actually put the new library anywhere you want; but this is a logical place and what Dreamhost recommends.
  • Create your own phprc file to override the default php.ini and type in a directive to load the new extension:
    echo "extension = /home/[username]/.php/5.3/uploadprogress.so" > ~/.php/5.3/phprc
    Substitute your own username for [username] in the above path.
  • If you want instant results (you can just wait a few minutes), you have to kill any current copies of the CGI which might be running thereby forcing the config to reload:
    killall php53.cgi

Check phpinfo(). You should see a heading Additional .ini files parsed that lists the path to your custom phprc file. You should also see information about the module uploadprogress. Reloading the Drupal status report should also show upload progress is now enabled.

This works because php 5.3 has some additional options for runtime configuration and Dreamhost has enabled the hooks necessary to allow the use of .php in your home directory. A more elaborate solution is to compile your own version of PHP in your home directory. http://wiki.dreamhost.com/Installing_PHP5 describes Dreamhost's recommended method.

Problems? Test it first!

Before approaching the Drupal community claiming that Drupal is broken make sure uploadprogress is working by installing the test files (see attached) into http://yoursite.com/test. You can also get the test files directly from PECL at http://svn.php.net/viewvc/pecl/uploadprogress/trunk/examples/ just download them all into the same directory and run index.php. Use these test scripts first and if you see progress appear here and not on Drupal than it is a Drupal problem.

Note: When testing this make sure that the hypertext protocol is the same as what it will be when you are uploading in Drupal. I.e. If you will be uploading with http:// test with http://. If you are uploading with https://, test with https://.

AttachmentSize
uploadprogress_test.tar_.gz15 KB

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

This works for me, but just in the D6.
With D7, whether dreamhost or my localhost(win7+xampp), the progress bar did not show up.
I don't know why but I will re-install everything again and test it later.

Hi

I've been through the steps and uploadprogress shows as being installed in php_info(). However, the progress bars don't work

I've also tried the example files that come with the uploadprogress distribution. They work fine on my local server, but not on Dreamhost.

Does it matter whether you're on 5.3 CGI or 5.3 FastCGI?

I'd heard that these upload extensions don't work properly as the CGI/FastCGI hosting prevent the two browser requests accessing each other's data.

Do you have an example of this running on dreamhost that I could verify mine against?

Cheers

Kieran

I don't know if it actually works because I haven't tested it, but, after turning off mod_security for my IP only, i followed these instructions to a T and it's showing as 'enabled' now under Drupal reports. Thank you very much for a very easy-to-follow tutorial on this!

- James

I don't know if it actually works because I haven't tested it, but, after turning off mod_security for my IP only, i followed these instructions to a T and it's showing as 'enabled' now under Drupal reports. Thank you very much for a very easy-to-follow tutorial on this!

- James