msns4345 Posted March 22, 2011 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.
Guest Geoff Posted March 22, 2011 Posted March 22, 2011 See http://php.net/manual/en/function.set-include-path.php
msns4345 Posted March 22, 2011 Author 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?
Guest Geoff Posted March 23, 2011 Posted March 23, 2011 Yes; I would recommend using a global PHP include file that you can make changes to all of your scripts.
msns4345 Posted March 23, 2011 Author 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!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now