msns4345 Posted March 22, 2011 Share Posted March 22, 2011 Hi everyone! I need to use a couple of PEAR packages for my website on heliohost, but I just can't set the include_path for my code to see these packages. The PEAR packages are being installed under /home1/my_domain/php/ My code is in this folder: /home1/my_domain/public_html/ If, for example, I need to use the package Net_UserAgent_Detect I have this line in my code: require_once( "Net/UserAgent/Detect.php" ); and I get this error: Fatal error: require_once() [function.require]: Failed opening required 'php/Net/UserAgent/Detect.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/missions/public_html/browser_sniffer.php on line 13 If I change the code to: require_once( "../php/Net/UserAgent/Detect.php" ); then everything works fine. The problem is that I need to use a lot of PEAR packages and some have tons of files I would need to modify the 'require_once' lines for. I think I need to add "../php/" to my include_path in PHP but I haven't been able to do that. I tried this: ini_set("include_path", '../php:' . ini_get("include_path") ); but no luck. It seems like heliohost does not let me edit php.ini. Can someone please tell me how I can add '../php/' to my include_path ? I would be very grateful! Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Guest Geoff Posted March 22, 2011 Share Posted March 22, 2011 See http://php.net/manual/en/function.set-include-path.php Quote Link to comment Share on other sites More sharing options...
msns4345 Posted March 22, 2011 Author Share Posted March 22, 2011 See http://php.net/manual/en/function.set-include-path.php Thank you, Geoff. It works! I see I wasn't setting the include_path correctly. I notice though that the new include_path doesn't stay saved. Do I have to have $path = '/home1/missions/php'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); in all of my scripts that use the PEAR packages? Quote Link to comment Share on other sites More sharing options...
Guest Geoff Posted March 23, 2011 Share Posted March 23, 2011 Yes; I would recommend using a global PHP include file that you can make changes to all of your scripts. Quote Link to comment Share on other sites More sharing options...
msns4345 Posted March 23, 2011 Author Share Posted March 23, 2011 Yes; I would recommend using a global PHP include file that you can make changes to all of your scripts. Ok. I see. Thanks a lot for your help! Quote Link to comment Share on other sites More sharing options...
jje Posted March 24, 2011 Share Posted March 24, 2011 Glad your problem got solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.