Installing PEAR on custom PHP installation

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Installing PEAR on custom PHP installation

Postby Zyxist » Thu Jan 27, 2011 5:30 am

Hi,

I have terrible problems with installing PEAR on my custom PHP installation. I hope that there is someone who is more skilled in configuring the default installer and would be able to help me. First, some background:

I built a custom web development environment under a Linux system, because the default packages were lacking several options and not-modular. I wanted to have a couple of different PHP versions installed and I managed to do that. Every PHP installation has a different configuration, and does not conflict with the rest. I have:
- /usr/bin/php - the production version to run different tools, such as phpMyAdmin etc.
- /usr/bin/php52 - the development version to run my scripts (PHP 5.2.x), with XDebug and other extra stuff activated.
- /usr/bin/php53 - like above, but this is PHP 5.3.x

They are connected to a web server through FastCGI. Some extra custom scripts make my code in my home directory available to the PHP parsers through symlinks, so I do not have to let the other system users enter my home directory. In addition, I have a special directory /srv/http, where various tools, libraries etc. are installed. I'm the only user of the computer.

Now, I want to install PEAR here. I just need it, where some libraries from PEAR repository are necessary and to manage my own packages. I gave up with PEAR 1.x, because the old package manager was very messy, and hard-to-reconfigure, so I jumped into Pyrus, which is supposed to solve the configuration problems. However, I don't see that anything changed. Pyrus attempts to force me to use its own repository layout which is much better suitable for server environments, not desktop computers, and I don't know how to tell him not to do so. In addition, there are errors in the documentation concering the configuration.

Here's what I do:

1. I generated a package for my distribution, which installs pyrus.phar in /srv/http/bin/pyrus.phar and pyrus Bash script in /usr/bin/pyrus.
2. I installed it.
3. I ran pyrus from the root user, because this is how it is intended to be used - it must be able to access the /srv/http directory.
4. Pyrus attempted to read a configuration file from the root home directory, which I don't want to add to open_basedir:

Code: Select all
Pyrus version 2.0.0a2 SHA-1: CA3946A5C2C7DE7CD6ED89CAC7CCC06606E006D3

Warning: file_exists(): open_basedir restriction in effect. File(/root/.pear/pearconfig.xml) is not within the allowed path(s): (/srv/http:/usr/share/pear/:/tmp:/home) in phar:///srv/http/bin/pyrus.phar/PEAR2_Pyrus-2.0.0a2/php/PEAR2/Pyrus/Config.php on line 575
Pyrus: No user configuration file detected
It appears you have not used Pyrus before, welcome!  Initialize install?
Please choose:
  yes
  no
[yes] : ^C


5. I tried again, this time from my home directory:

Code: Select all
[zyxist@eniac ~]$ pyrus
Pyrus version 2.0.0a2 SHA-1: CA3946A5C2C7DE7CD6ED89CAC7CCC06606E006D3
Pyrus: No user configuration file detected
It appears you have not used Pyrus before, welcome!  Initialize install?
Please choose:
  yes
  no
[yes] : yes
Great.  We will store your configuration in:
  /home/zyxist/.pear/pearconfig.xml
Where would you like to install packages by default?
[/home/zyxist] : /srv/http/PEAR2/
You have chosen:
/srv/http/PEAR2/
this path does not yet exist
Create it?
Please choose:
  yes
  no
[yes] : yes

Warning: is_writable(): open_basedir restriction in effect. File(/srv) is not within the allowed path(s): (/srv/http:/usr/share/pear/:/tmp:/home:/usr/bin) in phar:///srv/http/bin/pyrus.phar/PEAR2_Pyrus-2.0.0a2/php/PEAR2/Pyrus/Registry/Sqlite3.php on line 1434

Warning: is_writable(): open_basedir restriction in effect. File(/srv) is not within the allowed path(s): (/srv/http:/usr/share/pear/:/tmp:/home:/usr/bin) in phar:///srv/http/bin/pyrus.phar/PEAR2_Pyrus-2.0.0a2/php/PEAR2/Pyrus/Registry/Sqlite3.php on line 1434
PEAR2\Pyrus\Config\Exception: Cannot initialize primary registry in path /srv/http/PEAR2/
Exception: Unable to open database: unable to open database file


Of course, I know it would not work at all, because Pyrus tried to save my configuration in /home/zyxist/.pear/pearconfig.xml, but I wanted at least to have a sample configuration which I would modify manually. However, as you can see, when I entered the path to the repository: /srv/http/PEAR2, Pyrus suddenly tried to do something with /srv. WTF?

I tried also with go-pear.php, but it won't work in the my distro package building code, and an attempt to download the necessary PEAR packages and build something manually from scratch also failed.

Or maybe you know another custom PEAR package manager with more normal configuration? I just want to install some PHP libraries from PEAR channels in a more convenient way, nothing more, nothing less.

-----
Edit:

OK, I solved the problem in a bit different way. Creating a separate package for PEAR didn't work, so I hard-compiled it into my php-runtime package:

Code: Select all
./configure .... --with-pear
make
make INSTALL_ROOT=${pkgdir} install


It's not so elegant, but it works.
User avatar
Zyxist
Forum Contributor
 
Posts: 104
Joined: Sun Jan 14, 2007 11:44 am
Location: Cracow, Poland

Return to Installation and Configuration

Who is online

Users browsing this forum: No registered users and 1 guest