Page 1 of 2

Installing php-pear

Posted: Thu Jan 10, 2008 4:03 am
by raaqi
I did yum install php-pear. It's now in /usr/share/pear but it's not active. Do i need to reconfigure PHP? I don't have the original install files so i might have to re-download & reconfigure. Is this right?

configure command:

'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/usr/share/file/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

Posted: Thu Jan 10, 2008 5:21 am
by breun
What do you mean when you say "it's not active"? That configure line is not very relevant here, as that is the configure line that was used to build the core php package, php-pear is a separate package.

Posted: Thu Jan 10, 2008 5:50 am
by raaqi
Well, the test script i use is just coming up blank. I have php errors on, but i see nothing. just a blank page.

very strange.

Posted: Thu Jan 10, 2008 5:56 am
by breun
Have you checked your logs? By default errors are not logged to the browser (display_errors = Off), but just to the domain's error_log.

Posted: Thu Jan 10, 2008 5:59 am
by raaqi
Thanks, I think it's another issue actually. I ran a test via SSH. This is the result.

# php -q test.php

PHP Warning: require_once(): SAFE MODE Restriction in effect. The script whose uid is 10038 is not allowed to access /usr/share/pear/PEAR.php owned by uid 0 in /var/www/vhosts/...... on line 34


Safe_Mode is off (confirmed with phpinfo()). And i added base_dir string for pear... gah!

Posted: Thu Jan 10, 2008 5:59 am
by raaqi
Who should own PEAR? It's currently root:root. Should it be apache?

Posted: Thu Jan 10, 2008 7:05 am
by raaqi
i got this working for the client who needed it by chown'ing the pear dir to that user & group.

Posted: Thu Jan 10, 2008 7:06 am
by breun
When you run php from the command line it uses the settings from /etc/php.ini, so if you disabled safe_mode for the domain that doesn't mean you get the same environment when you run your script from the command line.

I have one domain here that uses PEAR files from /usr/share/pear and has /usr/share/pear added to its include_path (not necessary, but that makes for easier including) and open_basedir path in its vhost.conf, like this:

Code: Select all

<Directory /var/www/vhosts/example.com/httpdocs>
php_value include_path .:/usr/share/pear
php_admin_value open_basedir /var/www/vhosts/example.com/httpdocs:/tmp:/usr/share/pear
</Directory>
What does your config and test.php look like?

Posted: Thu Jan 10, 2008 7:08 am
by breun
raaqi wrote:i got this working for the client who needed it by chown'ing the pear dir to that user & group.
Then probably other domains won't be able to use PEAR. You might as well then just download the PEAR files you need and put them in the domain's documentroot and not use the php-pear package at all.

Posted: Thu Jan 10, 2008 8:54 am
by scott
Is this using PHP 5.2.5? And if so are you using php_admin_value to modify the include path anywhere on any domain?

Posted: Thu Jan 10, 2008 12:02 pm
by breun
You can check the above by executing this:

Code: Select all

# find /var/www/vhosts -name vhost\*.conf -print0 | xargs -0 grep php_admin_value.*include_path
However, I still seem to have include_path problems under PHP 5.2.5 even though the above code returns nothing.

Posted: Thu Jan 10, 2008 1:57 pm
by scott
Ive had to duke it out with some other apps, like tikiwiki and the include path set in php.ini. So far Ive found it easier to disable that, and then set it per domain (when I need to) with php_value.

Posted: Thu Jan 10, 2008 2:25 pm
by breun
To bad Plesk's php*-configurator package sets the include_path in /etc/php.ini to ".:", so you'll have to disable include_path every time Plesk does that.

Posted: Thu Jan 10, 2008 4:47 pm
by scott
Im debating making my own trigger to counter that :P

Posted: Thu Jan 10, 2008 5:40 pm
by breun
But if Plesk setting the include_path causes problems with PHP 5.2.5, shouldn't we just file a bug report with SWsoft about the issue?