« PEAR 1.4.2 released | Main | PHPUnit1 and PHPUnit2 which one to use ? »

Tips for re-distributing PEAR/PHP outside of php.net

Greg Beaver have posted nice tips for re-distributing PEAR/PHP outside of php.net. The problem if installroot was not set correctly pear command will be breaked which will cause fatal error on require_once. Greg gives two possible solutions for distributing PEAR 1.4.x, one for PHP versions earlier than 5.1, and one for PHP 5.1 and newer. For earlier PHP versions, the best thing to do is to perform these steps:

  1. install PEAR using installroot option, just as you always have
  2. ALSO bundle up the install-pear.php file from pear-core at cvs.php.net
  3. Use a %post option and run the CLI version of php on install-pear.php like so:
  4. %post
    php install-pear.php -d %{_libdir}/php/pear -b %{_bindir}
  5. Use a %postun option to erase the contents of PEAR via:
  6. %postun
    pear uninstall -n --ignore-errors PEAR
    rm -rf %{_libdir}/php/pear

the %post option will create all needed files, and the %postun option will cleverly erase binary PEAR files (like the pear command, pecl command, etc.) and then remove all other pear files.

The instructions for PHP 5.1 and newer are similar:

  1. Grab install-pear.phar from http://pear.php.net/install-pear.phar
  2. Use a %post option and run the CLI version of php on install-pear.phar like so:
  3. %post
    php install-pear.phar -d %{_libdir}/php/pear -b %{_bindir}
  4. Use a %postun option to erase the contents of PEAR via:
  5. %postun
    pear uninstall -n --ignore-errors PEAR
    rm -rf %{_libdir}/php/pear

Via Greg Beaver's blog

Bookmark this article at these sites
Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):