Overview
PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.
READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications or code is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.
Instructions
The following are the steps required to install most PECL extensions on the Grid. You can find a list of PECL extensions at http://pecl.php.net/packages.php.
- Connect to your Grid with SSH.
- Set your site number variable and current PHP path for later use:
$ export SITEID=`pwd | awk -F\/ '{ print $3 }'`
$ export PHPPATH=`php-stable -i | grep "Configure Command" | perl -pe "s/.*'.\/configure'\s*?'--prefix\=(.*?)'.*/\1/"`
TIP:
To verify and/or change what version of PHP is being used by your website, please visit the following Community article: How can I specify the PHP version on the Grid? - Create the following directories on your service:
$ mkdir /home/$SITEID/data/lib $ mkdir /home/$SITEID/data/lib/php/
- Run the command to download and decompress the package, and also navigate within the directory of the package:
TIP:
Replace "uploadprogress" with the package you wish to install.$ wget http://pecl.php.net/get/uploadprogress && tar zxvf uploadprogress && cd uploadprogress-* && $PHPPATH/bin/phpize
- Run the following command to configure the extension:
$ ./configure --with-php-config=$PHPPATH/bin/php-config
- Run the following command to compile the extension and copy it to the following folder:
$ make && cp modules/*.so /home/$SITEID/data/lib/php
- Next, you need to edit your php.ini file to load your PECL extension correctly. Here is an example:
NOTE:
Replace "uploadprogress" with the package you wish to install.
extension_dir=/home/00000/data/lib/php/ extension = uploadprogress.so
- Once you save the changes to your php.ini file, the PECL extension should work. You can verify this by looking at your phpinfo page:
READ ME FIRST
Installing, configuring, and troubleshooting third-party applications is outside the general scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.
If you're having trouble installing/configuring PECL extensions, additional assistance may be available through our Advanced Support service. Our expert engineers can tweak and tune your server for optimum performance. For more information on what Advanced Support can do for you, please visit this article.
Instructions
- Install the Developer Tools for your DV server.
- Log into your server with a root or sudo user via SSH.
- Create a temporary executable "/tmp" directory, as shown in steps 1-3 of this article.
- Perform a channel-update for PEAR and PECL:
# pear channel-update pear.php.net
# pecl channel-update pecl.php.net
- Install uploadprogress (or your desired extension).
# pecl install uploadprogress
NOTE
If all goes according to plan, you should see the following output:
Build process completed successfully Installing '/usr/lib64/php/modules/uploadprogress.so' install ok: channel://pecl.php.net/uploadprogress-1.X.X.X configuration option "php_ini" is not set to php.ini location You should add "extension=uploadprogress.so" to php.ini
- Remove the temporary executable "/tmp" directory as shown in step 4 of this article.
- The module will be installed in /usr/lib64/php/modules/ as /usr/lib64/php/modules/uploadprogress.so.
- Add the following line your php.ini:
extension=uploadprogress.so
NOTE:
Place under the "Dynamic Extensions" section!
If you are using FastCGI, edit the domain's "php.ini" file (i.e. /var/www/vhosts/your_domain/etc/php.ini)! - Reboot Apache:
# /etc/init.d/httpd restart
- Verify the installation of the PHP module by executing the following command:
# php -m
Compile from source
If the above method does not work for you, you'll need to compile the PECL extension from source, which is very easy.
- Browse to the directory you'd like the "temp" files to be stored at, in this case /root:
# cd /root
- Next we'll download and extract the actual PECL extension tar.gz file (be sure to replace the PECL extension with the one you want):
# wget http://pecl.php.net/get/uploadprogress-1.0.3.1.tgz && tar zxvf uploadprogress-1.0.3.1.tgz
- Next cd into the new directory and prepare for compiling:
# phpize && ./configure -with-php-config=/usr/bin/php-config
- Once finished we'll compile and install it:
# make && make install
- The module will be installed in /usr/lib64/php/modules/ as /usr/lib64/php/modules/uploadprogress.so.
- Add the following line your /etc/php.ini:
extension=uploadprogress.so
NOTE:
Place under the"Dynamic Extensions" section!
If you are using FastCGI, edit the domain's "php.ini" file (i.e. /var/www/vhosts/your_domain/etc/php.ini)! - Reboot Apache:
# /etc/init.d/httpd restart
Comments