PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old January 7th, 2008, 01:50 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
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!!!!!!

Reply With Quote
  #2  
Old January 7th, 2008, 03:07 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 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.

Reply With Quote
  #3  
Old January 7th, 2008, 03:29 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
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.


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.

Reply With Quote
  #4  
Old January 7th, 2008, 04:59 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
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/?

Reply With Quote
  #5  
Old January 7th, 2008, 06:55 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
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/?


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.

Reply With Quote
  #6  
Old January 8th, 2008, 03:05 AM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
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)

Reply With Quote
  #7  
Old January 8th, 2008, 08:17 AM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
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)



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

Reply With Quote
  #8  
Old January 8th, 2008, 10:24 AM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
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

Reply With Quote
  #9  
Old January 8th, 2008, 11:07 AM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
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.

Reply With Quote
  #10  
Old January 8th, 2008, 12:17 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
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.


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.

Reply With Quote
  #11  
Old January 8th, 2008, 01:23 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
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.

Reply With Quote
  #12  
Old January 8th, 2008, 01:57 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
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.


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

Reply With Quote
  #13  
Old January 8th, 2008, 02:02 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
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.

Reply With Quote
  #14  
Old January 9th, 2008, 12:24 PM
wmich wmich is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 wmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 5 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Please Help: cannot get PHP to recognize PEAR


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.
<