(dv):Install PECL extensions

  • This page was last modified on February 20, 2012, at 17:40.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications 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

  1. Install the Developer Tools for your (dv) Dedicated-Virtual Server.
  2. Log into your server with a root or sudo user via SSH.
  3. Run the following command to change the temp directory for PECL and avoid permissions errors about executing files in the /tmp directory:
    mkdir -p ~/tmp/pear/{cache,temp} && pear config-set download_dir ~/tmp/pear/cache && pear config-set temp_dir ~/tmp/pear/temp
    
  4. Perform a channel-update for PEAR and PECL:
    pear channel-update pear.php.net
    
    pecl channel-update pecl.php.net
    
  5. Install uploadprogress (or your desired extension).
    pecl install uploadprogress
    
  6. The module will be installed in /usr/lib/php/modules/ as /usr/lib/php/modules/uploadprogress.so.
  7. Add the following line your php.ini:
    extension=uploadprogress.so
    
  8. Reboot Apache.
    /etc/init.d/httpd restart
    

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.

  1. Browse to the directory you'd like the "temp" files to be stored at, in this case /root:
    cd /root
    
  2. 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 here PECL):
    wget http://pecl.php.net/get/uploadprogress-1.0.3.1.tgz && tar zxvf uploadprogress-1.0.3.1.tgz
    
  3. Next cd into the new directory and prepare for compiling:
    phpize && ./configure -with-php-config=/usr/bin/php-config
    
  4. Once finished we'll compile and install it:
    make && make install
    
  5. The module will be installed in /usr/lib/php/modules/ as /usr/lib/php/modules/uploadprogress.so.
  6. Add the following line your /etc/php.ini (Or if you're using FastCGI on Plesk 10, use /var/www/vhosts/yourdomain/etc/php.ini):
    extension=uploadprogress.so
    
  7. Reboot Apache.
    service httpd restart