If you want to add an upload progress bar/module using PHP or Ajax you need to have ACP and/or Uploadprogress installed to work with your PHP.
Installing ACP or Uploadprogress from cPanel PECL install doesnt work because it doesnt compile with--apxs so you need to install from the command line. The following is a step by step on how to get this working.
Login to Shell as root
Get the latest version of ACP or Uploadprogress:
ACP: http://pecl.php.net/package/APC
Uploadprogress: http://pecl.php.net/package/uploadprogress
I'll do ACP for example but the install is the same for uploadprogress
wget http://pecl.php.net/get/APC-3.1.2.tgz
Extract and move into the directory
gzip -d APC-3.1.2.tgz
tar -xf APC-3.1.2.tar
cd APC-3.1.2
Locate where php is:
which php
This should return something like: /usr/local/bin/php
Create configuration files:
phpize
Compile APC:
./configure --enable--apc --enable--apc--mmap --with--apxs --with--php--config=/usr/local/bin/php-config
make
make install
Find your php.ini
locate php.ini
Most likely the path will be /usr/local/lib/php.ini but may vary from server to server.
we will edit php.ini and add the APC extension and/or uploadprogress extension:
pico /usr/local/lib/php.ini
In the 'Paths and Directories' section of your php.ini you'll see this:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
extension = "uploadprogress.so"
extension = "apc.so"
Make sure it looks like the above (depending on your path to php extensions directory)
Now scroll down further in the php.ini to 'File Uploads', this is the step most tutorials leave out but is most important to making it work.
Just below:
; Maximum allowed size for uploaded files.
upload_max_filesize = ??m
Add this:
apc.rfc1867 = On
Without the above line nothing will work.
Now save the php.ini and restart Apache.
Done! you can now have an uploadprogress bar for upload forms.
An excellent step by step tutorial for creating upload progress bar using php and ajax can be found here:
http://www.phpriot.com/articles/php-ajax-file-uploads
Installing ACP or Uploadprogress from cPanel PECL install doesnt work because it doesnt compile with--apxs so you need to install from the command line. The following is a step by step on how to get this working.
Login to Shell as root
Get the latest version of ACP or Uploadprogress:
ACP: http://pecl.php.net/package/APC
Uploadprogress: http://pecl.php.net/package/uploadprogress
I'll do ACP for example but the install is the same for uploadprogress
wget http://pecl.php.net/get/APC-3.1.2.tgz
Extract and move into the directory
gzip -d APC-3.1.2.tgz
tar -xf APC-3.1.2.tar
cd APC-3.1.2
Locate where php is:
which php
This should return something like: /usr/local/bin/php
Create configuration files:
phpize
Compile APC:
./configure --enable--apc --enable--apc--mmap --with--apxs --with--php--config=/usr/local/bin/php-config
make
make install
Find your php.ini
locate php.ini
Most likely the path will be /usr/local/lib/php.ini but may vary from server to server.
we will edit php.ini and add the APC extension and/or uploadprogress extension:
pico /usr/local/lib/php.ini
In the 'Paths and Directories' section of your php.ini you'll see this:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
extension = "uploadprogress.so"
extension = "apc.so"
Make sure it looks like the above (depending on your path to php extensions directory)
Now scroll down further in the php.ini to 'File Uploads', this is the step most tutorials leave out but is most important to making it work.
Just below:
; Maximum allowed size for uploaded files.
upload_max_filesize = ??m
Add this:
apc.rfc1867 = On
Without the above line nothing will work.
Now save the php.ini and restart Apache.
Done! you can now have an uploadprogress bar for upload forms.
An excellent step by step tutorial for creating upload progress bar using php and ajax can be found here:
http://www.phpriot.com/articles/php-ajax-file-uploads
Last edited: