Re: [PHP-INSTALL] PHP build --with-pear fails: conflict over /tmp/pear/cache

[email protected] (Keith Roberts)
Newsgroups php.install
Message-ID <[email protected]>
On Wed, 12 Mar 2008, Ofer Inbar wrote:

> To: [email protected]
> From: Ofer Inbar <[email protected]>
> Subject: Re: [PHP-INSTALL] PHP build --with-pear fails: conflict over
>     /tmp/pear/cache
> 
> Keith Roberts <[email protected]> wrote:
>> I used to compile PHP without any --with/out-pear
>> ./configure options. This installed PEAR under the
>> --prefix=/usr/local/php-5.x.x directory path.
>
>> So everytime I upgraded PHP, I got a fresh installation of
>> PEAR in a different location. I now have PEAR installed
>
> More often than not, I'm doing a new build of the same version of PHP
> with different configure options to support something we didn't need
> in the past but do now, so I can't depend on a new version number.
>
> However, my php builds always install in /usr/local/lib/php/ without a
> version number.  During the build, they install in a temporary location
> that I (or my rpmbuild script) gives them.  For example,
>  make INSTALL_ROOT=/foo install
> Places it in /foo/usr/local/lib/php.
>
> However, it's still configured to work as though everything is under
> /usr/local/bin so when I actually install the RPM, which puts files
> there, everything looks like a default install.  That's pretty standard.
>
> In the past, php didn't have any problems with this method.
>
>> You need to check what config files are being used by each
>> installation of PEAR. They are quite possibly different. So
>> another PEAR installation in a different location should use
>> it's own set of config files.
>
> My goal, however, is to have each installation of PEAR in the *SAME*
> directory.  When the resulting RPM is installed on the system, it
> should replace whatever was there before.  Other files and scripts
> should not have to be updated - they should expect things to be in the
> same (default) locations.
>
>> I cannot see any problems with using a different
>> --with-pear=/new/path for testing purposes.
>
> Right, but what about for production purposes?  It should use
> /tmp/pear in a production install, it just should honor the temporary
> install root when building (and only when building).

Well I compiled PHP with the following ./configure options:
(I'm the only user on my system - 'keith' or 'root')

'./configure' \
'--with-apxs2=/usr/local/apache-2.2.6/bin/apxs' \
'--prefix=/usr/local/php-5.2.4' \
'--bindir=/usr/local/bin' \
'--enable-shared=all' \
'--with-pear=/usr/local/PEAR' \
'--with-mysql=shared,/usr/local/mysql-5.0.45' \
'--with-mysql-sock=/var/lib/databases/mysql/mysql.sock' \
'--with-mysqli=shared,/usr/local/mysql-5.0.45/bin/mysql_config' \
'--with-pgsql=/usr/local/postgresql-8.2.5/bin' \
'--with-xsl' \
'--with-zlib-dir=/usr/include' \
'--with-readline' \

Subsequent PHP compilations use:

'./configure' \
'--with-apxs2=/usr/local/apache-2.2.6/bin/apxs' \
'--prefix=/usr/local/php-5.2.4' \
'--bindir=/usr/local/bin' \
'--enable-shared=all' \

'--without-pear' \

'--with-mysql=shared,/usr/local/mysql-5.0.45' \
'--with-mysql-sock=/var/lib/databases/mysql/mysql.sock' \
'--with-mysqli=shared,/usr/local/mysql-5.0.45/bin/mysql_config' \
'--with-pgsql=/usr/local/postgresql-8.2.5/bin' \
'--with-xsl' \
'--with-zlib-dir=/usr/include' \
'--with-readline' \

So I now have PEAR in /usr/local/PEAR. Reason for doing this 
is to preserve the PEAR installation between OS upgrades. 
/usr/local is on a seperate partition. I have not had any 
problems with PEAR or the applications it provides not 
functioning correctly so far.

I generally run PEAR as root user anyway, so maybe that's 
why I have not encountered the /tmp/pear/cache writeable 
problem you mention. What about creating a seperate group 
for the /tmp/pear/cache, and adding your normal users to it, 
so they have write access to that dir?

Here is the output from pear config-show:

[root@karsites ~]# pear config-show
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels     auto_discover    1
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          /usr/local/bin
PEAR documentation directory   doc_dir          /usr/local/PEAR/doc
PHP extension directory        ext_dir          /usr/local/php-5.2.4/lib/php/extensions/no-debug-non-zts-20060613
PEAR directory                 php_dir          /usr/local/PEAR
PEAR Installer cache directory cache_dir        /tmp/pear/cache
PEAR data directory            data_dir         /usr/local/PEAR/data
PEAR Installer download        download_dir     /tmp/pear/cache
directory
PHP CLI/CGI binary             php_bin          /usr/local/bin/php
php.ini location               php_ini          <not set>
PEAR Installer temp directory  temp_dir         /tmp/pear/temp
PEAR test directory            test_dir         /usr/local/PEAR/test
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  stable
Unix file mask                 umask            22
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          /usr/bin/gpg
Signature Key Directory        sig_keydir       /usr/local/PEAR
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         root
maintainers)
User Configuration File        Filename         /root/.pearrc
System Configuration File      Filename         /usr/local/PEAR/pear.conf
[root@karsites ~]#

It seems that any modifications to PEAR's configuration 
using 'pear config-set' are written to the User 
Configuration File, not the System Configuration File. I 
must have installed PEAR as root user, because that is where 
the .pearrc file is located in.

HTH

Keith Roberts
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.