ScotDiddle Posted August 20, 2009 Share Posted August 20, 2009 Hi Folks, I inherited an already configured website with my new position as a LAMP programmer here in Richmond VA. My httpd.conf file does not have the PHPiniDir parm. php.ini is from /etc/php.ini, but I can't figure out how php decided to use that file, and my include_path as shown in phpinfo() is .;/usr/share/pear;/usr/share/php BUT , files included from DOC_ROOT php scripts from include/somePHPFile.php or javascript/someOtherPHPScript.php get included just fine. What gives ? Why no "unable to include file" messages from the compiler ? I have read that these directives could be in a .htaccess file, but I haven't been able to find any. Any help / clarification will be appreciated. Thanks, Scot L. Diddle, Richmond VA Quote Link to comment https://forums.phpfreaks.com/topic/171192-why-are-my-included-files-getting-included/ Share on other sites More sharing options...
corbin Posted August 20, 2009 Share Posted August 20, 2009 /etc/php.ini is probably the default location that was compiled into PHP. And the "." in the include path means current location. For example: /location/to/some/file.php <?php include 'file2.php'; In this order, PHP would look for: ./file2.php (which is equivalent to /location/to/some/file2.php) /usr/share/pear/file2.php /usr/share/php/file2.php Quote Link to comment https://forums.phpfreaks.com/topic/171192-why-are-my-included-files-getting-included/#findComment-902802 Share on other sites More sharing options...
ScotDiddle Posted August 24, 2009 Author Share Posted August 24, 2009 Hi Corbin, Yep, I did find: '--with-config-file-path=/etc' in my ini info display. If a leading dot works for includes, why worry about an include path at all ? Is this to restrict includes to just those foldders found in the include path directive ? Thanks for the input. Scot L. Diddle, Richmond VA Quote Link to comment https://forums.phpfreaks.com/topic/171192-why-are-my-included-files-getting-included/#findComment-905057 Share on other sites More sharing options...
corbin Posted August 25, 2009 Share Posted August 25, 2009 No, it is not to restrict. It's actually to help. For example, you can have common files any application can access in the same location without having to use an absolute path. (PEAR is typically added to the include_path variable for example.) If you want to limit what directories PHP can access, there is a variable, but I don't remember what it is. I'm sure googling could find it. I think it's something like include_top_directory or something. Quote Link to comment https://forums.phpfreaks.com/topic/171192-why-are-my-included-files-getting-included/#findComment-905458 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.