PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #8611

can't install as a non-root user

Details

Submitted2006-09-01 17:12 UTC
Fromgeocar at internetconnection dot net
StatusNo Feedback
PackagePEAR
PHP VersionIrrelevant
OSDebian 3
Roadmaps(Not assigned)

Comments

[2006-09-01 17:12 UTC] geocar at internetconnection dot net

Description:
------------
Installing as a non-root user fails if the home directory is not found off the root, or off a directory that is off the root.

To reproduce: make a user with the home directory /usr/local/someplace/users/yourusername

The permissions for yourusername should be 0750, and the user doesn't belong the group that "owns" his home directory.

Install _always_ fails with an error "cannot create /usr/local/someplace/users/yourusername"

I worked around the problem by making a symlink in /yourusername, performed the install, then used fine . -type f -print0 |xargs -0 perl -p -i -e 's/\/yourusername/\/usr\/local\/someplace\/users\/yourusername/sg'

and fixing up php.ini to point to the PEAR directory.

[2006-09-02 16:59 UTC] geocar at internetconnection dot net

I attempted to use gopear.

The directory does already exist.

It shouldn't matter if the user has the ability to create the directory or not.

[2006-09-02 19:38 UTC] geocar at internetconnection dot net

``Ok, and what is the permissions/owner of this directory and which which user to you run go-pear?''

I create a user:

mkdir -p /usr/share/web
chown root:root /usr/share/web
chmod 0711 /usr/share/web
useradd -d /usr/share/web/foo -g users foo
chown foo:www /usr/share/web/foo
chmod 0750 /usr/share/web/foo

foo logs in, and copies the php.cgi into ~/cgi-bin/php5 and runs:

$ PATH=$HOME/cgi-bin:$PATH
$ export PATH
$ lynx -source http://pear.php.net/go-pear \
| php5

as following the instructions, prefix is set to /usr/share/web/foo

install proceeds, after unpacking PEAR, and setting up config (attempting to create pear.conf) install aborts complaining that /usr/share/web/foo already exists.

If I ln -s /foo /usr/share/web/foo and run the install setting the "prefix" to /foo, and then editing all cases of /foo then install will succeed.

"It shouldn't matter if the user has the ability to create the directory or not."

If it does not exist, it obviously does matter. But this is not the case here. No, even if it doesn't exist.

the installer should mkdir and ignore its error code. It should instead test success using chdir, or opendir, or even by attempting to create a file in there (if its really attempting to test writability), or similar.

It should _not_ attempt_ to predict whether creating the directory will fail.

[2006-09-02 21:14 UTC] geocar at internetconnection dot net

Welcome to go-pear!

Go-pear will install the 'pear' command and all the files needed by
it. This command is your tool for PEAR installation and maintenance.

Go-pear also lets you download and install the PEAR packages bundled
with PHP: MDB2.

If you wish to abort, press Control-C now, or press Enter to continue:

HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation prefix : /usr/local
2. Binaries directory : $prefix/bin
3. PHP code directory ($php_dir) : $prefix/share/pear
4. Documentation base directory : $php_dir/docs
5. Data base directory : $php_dir/data
6. Tests base directory : $php_dir/tests
7. Temporary files directory : $prefix/temp

1-7, 'all' or Enter to continue: 1
Installation prefix [/usr/local] : /usr/share/web/jpetit

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation prefix : /usr/share/web/jpetit
2. Binaries directory : $prefix/bin
3. PHP code directory ($php_dir) : $prefix/share/pear
4. Documentation base directory : $php_dir/docs
5. Data base directory : $php_dir/data
6. Tests base directory : $php_dir/tests
7. Temporary files directory : $prefix/temp

1-7, 'all' or Enter to continue:
mkdir failed: </>
Unable to create PHP code directory ($php_dir) /usr/share/web/jpetit/share/pear.Run this script as root or pick another location.
jpetit@hermes:~$ ls -ld .
drwxr-x--- 14 jpetit www 4096 Sep 1 17:06 .
jpetit@hermes:~$ pwd
/usr/share/web/jpetit
jpetit@hermes:~$ ls -dl share/pear/
drwxr-xr-x 13 jpetit users 4096 Sep 2 21:12 share/pear/