Link to home
Start Free TrialLog in
Avatar of tel2
tel2Flag for New Zealand

asked on

PHP library path?

Hi Experts,

My PHP skills are lacking, and I recently downloaded and installed an OpenSource PHP program on a shared Linux webhosting account, but I got an error message when I browsed to the site:
  'MDB2 Library not found on the server.  See the readme file for how to work around this'

So, I followed the instructions in the readme file, which were basically to run these commands from the command line:
    pear install MDB2
    pear install MDB2_Driver_mysql

I ran those, and attached is a log of the installs.  I still got the same error from the browser.

I saw that the MDB2 etc files were installed into the php directory in my home directory (i.e. /home/my-account/php), but I guess PHP doesn't know to look there, so how can I tell it to?  (In Perl I'd do something like: 'use lib "/home/my-account/perl5/..."').

I ended up working around this by putting the MDB2 etc files into the directory of the application, but I'd like to know the proper way of dealing with this.

Here's the code which generated the error message (it's in include/init.php):
    // Set up the DB
    if (!@include_once('MDB2.php')) {
      trigger_error('MDB2 Library not found on the server.  See the readme file for how to work around this');
      exit();
    }

I do not have root access to this shared server, just command line access.

Thanks.
Tel2
pear-install-log.txt
ASKER CERTIFIED SOLUTION
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tel2

ASKER

Thanks for the prompt and most helpful response, bportlock!

I found a line near the top of include/init.php, which said:
    ini_set('include_path', ini_get('include_path').$path_sep.JETHRO_ROOT);
so I changed it to:
    ini_set('include_path', '/home/my-account/php:'.ini_get('include_path').$path_sep.JETHRO_ROOT);
and my problems were solved.

I have now deleted the MDB2 etc files that I installed in the root directory of the application, and all still works fine.

Thanks heaps!
I am glad it is all sorted out.