[RESOLVED] Can't do any PEAR

liunx

Guest
With this in one of our scripts:
require_once "/usr/bin/pear/Spreadsheet/Excel/Writer.php";

We get this fatal error:
Warning: require_once() [function.require-once]:
open_basedir restriction in effect.
File(/usr/bin/pear/Spreadsheet/Excel/Writer.php) is not within the allowed path(s):
(/home/crnorth:/usr/lib/php:/usr/local/lib/php:/tmp) in
/home/crnorth/public_html/new_site/exceltest.php on line 6

Warning: require_once(/usr/bin/pear/Spreadsheet/Excel/Writer.php)
[function.require-once]: failed to open stream:
Operation not permitted in /home/crnorth/public_html/new_site/exceltest.php on line 6

Fatal error: require_once()
[function.require]: Failed opening required '/usr/bin/pear/Spreadsheet/Excel/Writer.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
/home/crnorth/public_html/new_site/exceltest.php on line 6


PHPInfo() reports:
{System Linux web4.dvol.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686}
Configure Command:
'./configure' '--enable-bcmath' '--enable-calendar' '--enable-ftp'
'--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes'
'--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs'
'--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr'
'--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr'
'--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-dir=/opt/xml2/'
'--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock'
'--with-png-dir=/usr' '--with-ttf' '--with-xpm-dir=/usr/X11R6' '--with-zlib'
'--with-zlib-dir=/usr'

include_path.:/usr/lib/php:/usr/local/lib/php

Is it true that there has to be either a configure command '--with-pear...' or
/usr/bin/pear has to be in the include _path?

dvol support says that pear is installed in /usr/bin/pear.../usr/bin/pear needs to be added to the open_basedir path list setting in php.ini.I have no control over these settings on a shared server.

Oh using:

set_include_path(get_include_path() . PATH_SEPARATOR . '/user/bin/pear');


resulted in this:
Warning: require_once(Spreadsheet/Excel/Writer.php)
[function.require-once]: failed to open stream: No such file or directory in
/home/crnorth/public_html/new_site/exceltest.php on line 9

Fatal error: require_once() [function.require]: Failed opening required
'Spreadsheet/Excel/Writer.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php:/user/bin/pear') in
/home/crnorth/public_html/new_site/exceltest.php on line 9/usr/bin/pear needs to be added to the open_basedir path list setting in php.ini.

It is now:
open_basedir:/home/crnorth:/usr/lib/php:/usr/local/lib/php:/tmpIf your host is going to have open_basedir in effect but not include the PEAR directory in it, then you will never be able to use that directory. You will therefore need to consider downloading and installing the necessary PEAR packages in your account's directory space.From what I've read about the installation process it's fairly hairy...I guess that's why I never messed with it before.You can actually download the class you need from the pear.php.net site and install it wherever you want without using the automated PEAR installation software. However, you then need to manually determine if there are any dependencies involved requiring you to download and install any other PEAR packages, whereas the PEAR install software automatically takes care of any such dependencies.
 
Back
Top