Koozali.org: home of the SME Server

Can't get PEAR modules to work on SME v6.0.1.-1

Offline johnwmcc

  • **
  • 25
  • +0/-0
Can't get PEAR modules to work on SME v6.0.1.-1
« on: October 31, 2005, 12:28:41 AM »
I'm running SME Server 6.0.1-1 and PHP 4.3.10 which automatically installed several PEAR modules, in /usr/share/pear. This was set automatically in the php.ini include_path line, which reads
include_path = .:/usr/share/pear:/home/e-smith/files/Primary/php   

(some other php functions are in the ...Primary/php directory, and the includes for them work fine.)

But I can't get any .php files in the /usr/share/pear directory (even test ones of my own copied in there with owner/group as admin/share) to work with the php 'include()' or 'require' functions from a page in the /Primary/html web root.

I've also downloaded and installed several other PEAR modules, using the pear install <package> command, including HTML_Common and HTML_QuickForm. I've also upgraded the default installed pear functions using pear upgrade-all. There weren't any error messages there either, except one Segment Fault about XML_RPC, which didn't recur when I first downloaded the package then installed it again. I can see the files (using Midnight Commander) and they are indeed all installed in /usr/share/pear and subdirectories off it.

Pear modules/functions just don't seem to be working at all, but I don't know where to look for clues about why not.

Sample pages taken from tutorials on the web and uploaded to the SME Server give no error messages, and either completely blank output in the browser (nothing visible even in View Source) or occasionally just <html></html><body></body> in the source view, but blank in the normal browser window depending on the example. Even if the <?php ...  php> code is followed by HTML text, the HTML doesn't display either.

All the automatically installed PEAR directories and files have owner/group set as root/root and permissions as 0755.

I've also installed the PEAR modules on my local Windows XP SP2 machine, and the same tutorial examples work first time with no problems, so the examples themselves seem to be ok - it's just something on the SME Server setup that's stopping them working.

I've searched the Contribs.org site, and the web (including the PEAR manual) for permutations of 'pear' 'include_path'  'owner' 'permissions' and so on, and can't find anything that suggests this is a problem anyone else has had, let alone solved!

It doesn't even work using php code in the calling page to specify the include path temporarily.

Any thoughts on where to look for further help, please, or what might be stopping the PEAR includes from being read or executed by the php processor?

I have restarted apache, and indeed the whole server, without making any difference.

Thanks if you can help - I feel completely stuck after having spent six or seven hours experimenting with different test pages.

John McC

Offline johnwmcc

  • **
  • 25
  • +0/-0
Have now succeeded!
« Reply #1 on: October 31, 2005, 11:59:01 PM »
I've now got PEAR to work on SME Server 6.0.1-1. Simple, once I worked it out, but not initially obvious to me at all.

PHP is always limited to using 'include' and 'require' scripts located in or below the directory specified in the PHP directive set in 'open_basedir'. By default on SME Server this is the Primary ibay (/home/e-smith/files/ibays/Primary).

PEAR scripts in the default installation directory are in /usr/share/pear which is OUTSIDE the base directory tree, and hence 'includes' of PEAR modules just don't work, but don't give an error, either.

I found this out the hard way, by remembering I had had this problem before, when trying to put certain 'confidential' php scripts outside the web server document root (...Primary/html on SME Server), and finding that they had to stay within the Primary directory tree. I reinstalled the PEAR modules, choosing to put the scripts in Primary/share/ and subdirectories, then having the install script add this directory tree to the PHP include_path in php.ini.

I can now see (I think, but haven't yet tried) that it should also work if I leave the PEAR install in the default /usr/share/pear, and instead of relocation all the scripts, I just add a second path of /usr/share/pear to the open_basedir directive in php.ini (and then to the custom template that changes php.ini on a reboot, so I don't lose it).

But WHY, oh WHY, can't the otherwise excellent install scripts for PEAR, and/or the SME Server setups do this for us? I've wasted literally a day working this out for myself, and either no one else using SME Server uses PEAR (improbable) or everyone else is a clever enough LAMP (Linux, Apache, MySQL and PHP) guru just to 'know' the answer!

If there is anyone else stuck in the same position, maybe this will save them some time.

John McC