(gs):Install PECL extensions
- This page was last modified on April 1, 2012, at 17:05.
From (mt) Community Wiki
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.
Contents |
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.
Instructions
The following are the steps required to install most PECL extensions on the (gs) Grid-Service. You can find a list of PECL extensions at http://pecl.php.net/packages.php.
- Connect to your (gs) Grid-Service with SSH.
- Set your site number variable and current PHP path for later use:
export SITEID=`pwd | awk -F\/ '{ print $3 }'`If your site uses PHP 5.2.17:
export PHPPATH=`php5 -i | grep "Configure Command" | perl -pe "s/.*'.\/configure'\s*?'--prefix\=(.*?)'.*/\1/"`
If your site uses PHP 5.3.10:
export PHPPATH=`php-latest -i | grep "Configure Command" | perl -pe "s/.*'.\/configure'\s*?'--prefix\=(.*?)'.*/\1/"`
To verify and/or change what version of PHP is being used by your website, please visit the following KnowledgeBase link: How can I specify the PHP version on the (gs) Grid-Service?
- 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:
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:
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:
