Re: Re: second/custom PEAR/PECL installation. possible? how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/6/07, Greg Beaver <cellog@xxxxxxx> wrote:
Jochem Maas wrote:
> I have a [gentoo] server with 2 apache installations ...
>
> the std distro apache runs with php4 which includes an installation
> of PEAR and PECL.
>
> the second apache is compiled by hand and runs with php5 (also compiled
> by hand) - obviously both of these are installed somewhere other than
> the default. the [custom] php5 installation does not include PEAR/PECL
> (when I built/installed it I skipped that because I was worried I'd get a conflict
> with the existing PEAR/PECL install and break something).
>
> I would like to add the APC extension to the php5 setup, normally this is
> as involved as doing the following:
>
>       > pecl install apc
>
> only in this case that would install APC in the php4 setup.
> the question is how do I go about getting a second/custom PEAR/PECL setup running
> which I can use with/for the php5 setup. is this even possible? or
> am I stuck with a manual download, compile and install of APC for the
> php5 setup as described here for instance:
> http://carroll.org.uk/archives/2006/02/02/alternative-php-cache-apc-on-debian)?

Hi Jochem,

If you're having PEAR questions, ask on the pear-general list.  It's
pure luck that I happened upon your message, and nobody on php-general
seems to know jack about PEAR.

The solution is quite easy.

You need separate configuration files for PEAR in PHP5.  To get this
going, you should first install a local copy of PEAR for PHP5 only.

Assuming you have PEAR in /usr/local/lib/php, the best choice is to
install another copy in /usr/local/lib/php5:

First you'll need to create a new configuration file, which you can save
as "/etc/pear5.conf".  Your php4 conf will be in /etc/pear.conf.  Then
you need to create a new directory for downloads to avoid conflicts
(easy).  The most important part is to set the php_bin variable to the
path to php5 and finally install your custom copy of PEAR.  I assume you
are using "php5" as the CLI for PHP 5.  Change this to the right name in
`which php5` if I'm wrong.

sudo pear config-create /usr/local/lib/php5 /etc/pear5.conf
sudo pear -c /etc/pear5.conf config-set php_bin `which php5`
sudo pear -c /etc/pear5.conf config-set download_dir /tmp/pear5
mkdir /tmp/pear5
chmod 0777 /tmp/pear5
sudo pear -c /etc/pear5.conf up PEAR

At this point you will have a new pear and pecl executable stored in
/usr/local/lib/php5/pear/.  You'll also want to set the ext_dir to the
location of your extension_dir in php.ini for php5.

sudo pear -c /etc/pear5.conf config-set ext_dir /path/to/php5/ext

Finally, as a convenience, you'll probably want to use ln to make
"pear5" and "pecl5" commands

sudo ln -s /usr/local/lib/php5/pear/pear /usr/local/bin/pear5
sudo ln -s /usr/local/lib/php5/pear/pecl /usr/local/bin/pecl5

Lastly, you will *always* want to call with the -c option

pecl5 install APC

will still use your default configuration file at /etc/pear.conf.

pecl5 -c /etc/pear5.conf install APC

will correctly install and configure APC for php5.

Needless to say, this is more complicated than it seems like it should
be, and the next version of the PEAR installer, Pyrus, makes this
process MUCH easier.  Pyrus has only just been started, and so is barely
past proof-of-concept.

I hope this helps out.

Greg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


My work machine is a OS X iMac that has Apple's php4 standard, plus I
have a php4 and php5 custom compiled myself.  I've been able to issue
sudo /path/to/php4/bin/pear or /path/to/php5/bin/pear and that
installs the packages correctly for each version that I want.
Apparently this practice is completely wrong given that long string of
commands seen above.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux