doni49 Posted September 22, 2006 Share Posted September 22, 2006 I use a webhost for my websites. I have one main domain with 2 add-on domains. I've had this service for about a year.Since that time, I've had three seperate PHP.ini files--one in the public_html folder for each domain. The purpose of each PHP.ini file is that it sets the include search path for each domain. But now all of a sudden, the PHP.ini file stopped loading therefore the include path has not been set as it's supposed to be and has been for the past year.When I asked my web host about it, I was informed that it should NEVER have worked this way and they don't allow individuals to use their own PHP.ini files.Anyone have any ideas on how I can set the include path for MY domains on a hosted account? I don't want to have to specify the whole path with every include statement but I want to keep the include files seperate for security reasons.Thanks.EDIT: Ok I've found something that SEEMS like it should be what I need. But it's not working as expected.First here's a link to a tutorial I found on this site. www.phpfreaks.com/tutorials/10/0.php There are three examples shown in the tutorial, I'm looking at the THIRD example. The following is what I put in my .htaccess file (I do have rights to keep my own .htaccess file):[b]php_value include_path .:[color=red]/home2/username/includefolder1[/color]:[color=red]/home2/username/public_html/php[/color]:/usr/lib/php:/usr/local/lib/php[/b]When I try to load a web page with this line there, I get an internal server error (500). When I take this line out, it just tells me that it can't find my include files.I need it to look 1st in the same folder as the page that's loading. Then in the two folders that are RED above. Then to the default location as provided by the server's default settings. The following is the default include_path before I make my changes (as told by [i]phpinfo()[/i]).[b].:/usr/lib/php:/usr/local/lib/php[/b]Thanks again! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 23, 2006 Share Posted September 23, 2006 Try surrounding it in quotes:[code]php_value include_path ".:/home2/username/includefolder1:/home2/username/public_html/php:/usr/lib/php:/usr/local/lib/php"[/code]Also make sure you have changed [b]/home2/username/includefolder1[/b] and [b]/home2/username/public_html/php:/[/b] to the correct location. If it still doesnt work ask you hosts whether you can use the php_value directive in a .htaccess file.If that doesnt work. Then you'll define the location of the files in your script. You can create a constent called INC_PATH, this constant will then holds the path to your include folder, where all you include files are located[code=php:0]define('INC_PATH', '/path/to/my/include/folder/');[/code]Then when you want to include a file that is in your include folder you'll use the following:[code=php:0]include INC_PATH . 'filetoinclude.php';[/code]That is the only otherway if you host doesnt allow you to use your own php.ini and has disabled the php_value directive in the .htaccess file. 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.