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:
- install PEAR using installroot option, just as you always have
- ALSO bundle up the install-pear.php file from pear-core at cvs.php.net
- Use a %post option and run the CLI version of php on install-pear.php like so:
- %post
php install-pear.php -d %{_libdir}/php/pear -b %{_bindir} - Use a %postun option to erase the contents of PEAR via:
- %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:
- Grab install-pear.phar from http://pear.php.net/install-pear.phar
- Use a %post option and run the CLI version of php on install-pear.phar like so:
- %post
php install-pear.phar -d %{_libdir}/php/pear -b %{_bindir} - Use a %postun option to erase the contents of PEAR via:
- %postun
pear uninstall -n --ignore-errors PEAR
rm -rf %{_libdir}/php/pear


