Help - Search - Members - Calendar
Full Version: How to get Pear running...
The Planet Forums > System Administration > Virtualization
cosmo
Hi...

I read on some dedicated hosts that to get Pear running w/ PHP, all you have to do is to include Pear's path in the php.ini or within the PHP script itself. But how does one get it working on a virtual host? I have tried everything to no avail. Please advise.
Catalyst
Ensim? http://forums.ev1servers.net/showpost.php?...675&postcount=2
cosmo
Ensim, yes.

Other than php-devel, everything is there...

QUOTE
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux' '--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-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mime-magic=/usr/share/file/magic.mime' '--with-apxs2=/usr/sbin/apxs'


I am under a virtualhost with very limited permissions (for example, I can cd /etc, but can't create any directories or modify any files). I can see clearly that pear was built into PHP, but why can't I get it to run even if I included the path within my PHP file itself!? I also tried running the Pear installer with similar issues (permission problems).

Thanks.
Catalyst
You can't use the PEAR installer.

What are you trying to do?
cosmo
i am just trying to get Pear working, that's all. The following script will fail:

[PHP]
$PEAR_PATH='/usr/share/pear/';
ini_set('include_path', ini_get('include_path').':'.$PEAR_PATH);

// Include the QuickForm class
require_once ("QuickForm.php");

// Instantiate the QuickForm class
$form = new HTML_QuickForm('quickForm1', 'POST');

// Add a text input field called firstName,
// labelled "Enter your name"
$form->addElement('text', 'firstName', 'Enter your name');

// Add a submit button called submit with "Send" as the text
// for the button
$form->addElement('submit', 'submit', 'Send');

// If the form is submitted...
if (isset($_POST['submit'])) {
// Display the submitted value "firstName"
echo 'Hello ' . $form->getSubmitValue('firstName');
} else {
// If not submitted, display the form
$form->display();
}

?>[/PHP]

The errors are:
CODE
Warning: main(QuickForm.php): failed to open stream: No such file or directory in /home/virtual/site5/fst/var/www/html/test.php on line 7



Fatal error: main(): Failed opening required 'QuickForm.php' (include_path='.:/php/includes:/usr/share/php:/usr/share/pear/') in /home/virtual/site5/fst/var/www/html/test.php on line 7


And of course, I tried including the path to Pear in php.ini without success:
CODE
include_path = ".:/php/includes:/usr/share/php:/usr/share/pear"


I have done everything short of creating that script in "/etc/virtualhost... etc" because my account doesn't allow me to create such directory within the virtualhost...

Thanks again.
Catalyst
Ahh, see, no --- you're trying to get PEAR::HTML_QuickForm working. That isn't a standard PEAR package.

So --- create an /includes/pear directory off the webroot and download it there. You can find a little more information in the PEAR FAQ.
cosmo
You definitely have helped me move along further than I could have by myself...

For one reason or another, PHP just won't find the path... I went through the FAQ and did exactly what they said I should do and here's what returned:

CODE
$ which pear

/home/admin/pear/bin/pear



$ echo $PATH

/home/admin/pear/bin:/usr/local/bin:/bin:/usr/bin:/home/admin/bin



$ php pear

Status: 404

Content-type: text/html

X-Powered-By: PHP/4.3.9


As for "php.ini", pear-go.php included the following line:
CODE
;***** Added by go-pear

include_path=".:/home/admin/pear/share/pear:/php/includes:/usr/share/php"
;*****


I also did "export PATH=/home/user/pear/bin:$PATH" in my ~/.bashrc...

But when I ran the script, same thing! It's as if the path never existed!!
CODE
Warning: main(HTML/QuickForm.php): failed to open stream: No such file or directory in /home/virtual/site5/fst/var/www/html/test.php on line 8



Fatal error: main(): Failed opening required 'HTML/QuickForm.php' (include_path='/home/admin/pear;.:/php/includes:/usr/share/php') in /home/virtual/site5/fst/var/www/html/test.php on line 8


I even included what the Pear FAQ suggested to initialize the path:
[php]$path = ini_get('include_path');
ini_set('include_path', '/home/user/pear;'.$path);[/php]

Nada...
CODE
Warning: main(HTML/QuickForm.php): failed to open stream: No such file or directory in /home/virtual/site5/fst/var/www/html/test.php on line 9



Fatal error: main(): Failed opening required 'HTML/QuickForm.php' (include_path='/home/admin/pear;.:/php/includes:/usr/share/php') in /home/virtual/site5/fst/var/www/html/test.php on line 9


So I echoed the "ini_set" to see what's actually there...
[php]$path = ini_get('include_path');
$path .= ini_set('include_path', '/home/admin/pear;'.$path);
echo $path;[/php]

And it gave me...
CODE
.:/php/includes:/usr/share/php.:/php/includes:/usr/share/php


It's like all that work I did went to waste... PHP never saw the path in the first place! This is just wierd... even after I have set the "include_path" in php.ini!
Catalyst
Add the following to wherever you're trying to set the path:
CODE
ini_set('include_path', ini_get('include_path').':/home/admin/pear');
No variable needed.
cosmo
Thanks for your patience in helping me out on this issue.

I have tried everything plus what you have suggested. And the server is stil giving me similar errors. It's incredible that everyone else got Pear running on his virtual host account!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.