|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Please Help: cannot get PHP to recognize PEAR
Hello I’m a newbie to Linux. I’m having trouble getting PHP to recognize PEAR on my VDS (virtual dedicated server) running Fedora 7. The server came pre-installed with PHP 5.2.4, Apache2.26, and MySQL 5.0.45 and PEAR I assume. I assume PEAR is installed because I was able to run “yum info php-pear” at the shell. Results:
============================== Name : php-pear Arch : noarch Epoch : 1 Version: 1.5.0 Release: 3 Size : 2.1 M Repo : installed Summary: PHP Extension and Application Repository framework Description: PEAR is a framework and distribution system for reusable PHP components. This package contains the basic PEAR components. ============================== Result from running “pear config-show”: Configuration (channel pear.php.net): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir /usr/bin PEAR documentation directory doc_dir /usr/share/pear/doc PHP extension directory ext_dir /usr/lib/php/modules PEAR directory php_dir /usr/share/pear PEAR Installer cache directory cache_dir /var/cache/php-pear PEAR data directory data_dir /usr/share/pear/data PEAR Installer download download_dir /var/cache/php-pear directory PHP CLI/CGI binary php_bin /usr/bin/php php.ini location php_ini <not set> PEAR Installer temp directory temp_dir /var/tmp PEAR test directory test_dir /usr/share/pear/test Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /etc/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename /root/.pearrc System Configuration File Filename /etc/pear.conf ============================== I’ve also added path in php.ini to the follow: “include_path =”.:/usr/share/pear”. PHP is not running on safe mode. I’ve added path to the .bash_profile with the following:”PATH=$PATH:$HOME/bin:usr/share/pear” I can only find 2 mention of PEAR if I run phpinfo(). First, in the Configure Command” section it reads “without-pear” (yes very fishy) second, in the path “.:/usr/share/pear”. I’ve been testing with the following test script that I found on the web: Code:
<?php
if (require 'PEAR.php') {
echo "You can now use PEAR with PHP!";
} else {
echo "PEAR is not recoginzed with your PHP.";
}
?>
============================== Results from script above: Warning: require(/pear/PEAR.php) [function.require]: failed to open stream: No such file or directory in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Fatal error: require() [function.require]: Failed opening required '/pear/PEAR.php' (include_path='.:/usr/share/pear') in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 ============================== Please help me I’m about to blow my head off!!!!!! |
|
#2
|
|||
|
|||
|
Are you sure that you have
require 'PEAR.php' in your test script and not require '/pear/PEAR.php' ? The error message indicates more the latter. |
|
#3
|
|||
|
|||
|
Quote:
Thanks, you are right. I was changing some code around hoping that I was pointing to the wrong directory and forgot to change it back before posting my thread. But after changing the require back to "require 'PEAR.php'" and not "require '/pear/PEAR.php' the problem persist. |
|
#4
|
|||
|
|||
|
Okay, what is the error message now? Did you change the PEAR configuration in the meantime? Can you check whether PEAR.php exists in /usr/share/pear/?
|
|
#5
|
|||
|
|||
|
Quote:
Hello wiesemann, After changing the "require 'PEAR.php'" I get the following error Warning: require(PEAR.php) [function.require]: failed to open stream: No such file or directory in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Fatal error: require() [function.require]: Failed opening required 'PEAR.php' (include_path='/usr/share/pear') in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 /usr/share/pear/PEAR.php does exist its 1,118 lines long. On a side note, I was able to run pear run-tests on a couple of mail test scripts(.phpt) without any errors. Thanks for your help again wiesemann. |
|
#6
|
|||
|
|||
|
Hmm, strange. Two ideas:
- change the include_path to '.:/usr/share/pear' (usually the current dir [.] also needs to be in this path) - try to call require '/usr/share/pear/PEAR.php'; in your script (just for debugging, but now the file should be found) |
|
#7
|
|||
|
|||
|
Quote:
Do you mean to add ".:" or do you mean to use single quotes instead of double quotes? I did have ".:" in front of my include path already. I tried using single quote and I received the same error. I understand that usually the current php directory would be included in the path as well but since everything else is working I did not want to mess around with something that is working already. I've added require '/usr/share/pear/PEAR.php' to my code and received the following error. Warning: require() [function.require]: open_basedir restriction in effect. File(/usr/share/pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/xxx.com/httpsdocs:/tmp) in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Warning: require(/usr/share/pear/PEAR.php) [function.require]: failed to open stream: Operation not permitted in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Fatal error: require() [function.require]: Failed opening required '/usr/share/pear/PEAR.php' (include_path=''.:/usr/share/pear'') in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 I also added the following at the beginning of my code: "ini_set("include_path", "/usr/share/pear");" and change the require back to "require 'PEAR.php'" and received the following error: Warning: require(PEAR.php) [function.require]: failed to open stream: No such file or directory in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Fatal error: require() [function.require]: Failed opening required 'PEAR.php' (include_path='/usr/share/pear') in /var/www/vhosts/xxx.com/httpsdocs/test.php on line 3 Well I guess there is hope with the new "restriction" error message. I will look into it and post any new findings. Thanks |
|
#8
|
|||
|
|||
|
I've made some progress. I moved the /usr/share/pear directory into my httpsdocs then I changed my require statement to require 'pear/PEAR.php' and I got it to work. So I think this maybe some sort of permission problem? Any ideas why it wouldn't work at /usr/share/pear? Again this is a VDS running Fedora 7 and Plesk 8 with GoDaddy.
Thanks |
|
#9
|
|||
|
|||
|
It doesn't work in /usr/share/pear because of the open_basedir setting. If you're the only user on this server, you can safely turn it off in php.ini.
My suggestion about the include_path was to add ".:", i.e. to add the current directory. Using single or double quotes doesn't matter. (BTW, did you restart Apache after making changes in php.ini? Otherwise, your changes won't take effect.) If you want to have PEAR working, you should make sure that require 'PEAR.php'; works, i.e. just with PEAR.php, not with any path information added here. Otherwise packages won't be able to find their files. |
|
#10
|
|||
|
|||
|
Quote:
Thanks for the reply wiesemann. I looked in php.ini and "open_basedir =" was commented out so I assume that it is off. Yes, I've been restarting Apache on every change in php.ini. I know its important to get PEAR working at its native path. I don't know what else to do at this point, but I will keep on searching. |
|
#11
|
|||
|
|||
|
Do you have full control over this server? Is there an administration tool like Confixx or Plesk active? Somewhere open_basedir seems to be enabled, maybe in a .htacess file.
|
|
#12
|
|||
|
|||
|
Quote:
Yes, I am running Plesk 8. I did a search on a ".htaccess" and found a lot of them. Which one should I look at for the open_basedir option? /etc/psa-horde/mimp/.htaccess /etc/psa-horde/kronolith/.htaccess /etc/psa-horde/mnemo/.htaccess /etc/psa-horde/horde/.htaccess /etc/psa-horde/turba/.htaccess /etc/psa-horde/passwd/.htaccess /etc/psa-horde/ingo/.htaccess /etc/psa-horde/imp/.htaccess /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/.htaccess /usr/share/psa-horde/lib/.htaccess /usr/share/psa-horde/kronolith/scripts/.htaccess /usr/share/psa-horde/templates/.htaccess /usr/share/psa-horde/po/.htaccess /usr/share/psa-horde/mnemo/scripts/.htaccess /usr/share/psa-horde/locale/.htaccess /usr/share/psa-horde/turba/lib/.htaccess /usr/share/psa-horde/turba/templates/.htaccess /usr/share/psa-horde/turba/po/.htaccess /usr/share/psa-horde/turba/locale/.htaccess /usr/share/psa-horde/turba/scripts/.htaccess /usr/share/psa-horde/passwd/lib/.htaccess /usr/share/psa-horde/passwd/templates/.htaccess /usr/share/psa-horde/passwd/po/.htaccess /usr/share/psa-horde/passwd/scripts/.htaccess /usr/share/psa-horde/ingo/scripts/.htaccess /usr/share/psa-horde/imp/lib/.htaccess /usr/share/psa-horde/imp/templates/.htaccess /usr/share/psa-horde/imp/po/.htaccess /usr/share/psa-horde/imp/locale/.htaccess /usr/share/psa-horde/imp/scripts/.htaccess /usr/share/psa-horde/scripts/.htaccess thanks |
|
#13
|
|||
|
|||
|
These paths all seem to belong to Horde or phpMyAdmin, i.e. they shouldn't affect the directory with your test script.
But maybe you can disable open_basedir directly in Plesk? Maybe Google can tell you more about the conjunction between open_basedir and Plesk, and maybe some other weird things that Plesk does with PHP and PEAR. |
|
#14
|
|||
|
|||
|
GOT IT! Thanks for the tip wiesemann! It turns out to be Plesk that was restricting the access of the PEAR directory. To allow access to PEAR directory, a vhost_ssl.conf file must be created with the path of httpsdocs and the PEAR directory. Please follow this link http://kb.swsoft.com/en/432
Thanks for your help again wiesemann. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > Please Help: cannot get PHP to recognize PEAR |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|