Rabbie Posted October 18, 2007 Share Posted October 18, 2007 Hi I am using PHP with Windows and I am having a few problems with the include function. If I use include("filename.php") or include("dir/filename.php") it works correctly If I use include ("./dir/filename.php") it doesnt include the file. I need this to work so I can use PHPMyadmin for MySQL database control. I have tried googling for a solution without success. In my php.ini file I have include_path = ".\"; What should this be set to please to get this to work? Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/ Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 Can you post your php.ini file? <?php include('xxx.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372539 Share on other sites More sharing options...
Rabbie Posted October 18, 2007 Author Share Posted October 18, 2007 Thanks for your reply. I really want this to work correctly by changing php.ini rather than having to change massive amounts of scripts in the PhpMyadmin package. I hoped I had explained that in my initial post Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372543 Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 http://us.php.net/set_include_path Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372545 Share on other sites More sharing options...
Rabbie Posted October 18, 2007 Author Share Posted October 18, 2007 here is a copy of my php.ini file [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372556 Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 It looks like you have your include path set to whatever the site's root directory is. I'll continue to read your code over. Is PHP running in safe mode? Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372575 Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 Here is what I can see. The reason that ("./dir/filename.php") doesn't work is because you have specified that includes default to the root web directory. Having the '.' preceding the slash knocks you back another directory which ultimately produces an invalid path to the file. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372584 Share on other sites More sharing options...
Rabbie Posted October 18, 2007 Author Share Posted October 18, 2007 I am only using this way because it is in the phpmyadmin files. I don't know why they use the include "./ format but it should work being a well proven product. I am sure it is an issue in my php.ini since I can replicate the fault in my own files. I have taken out the include_path directive and it made no difference. what worked before still works and the other still doesn't Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372618 Share on other sites More sharing options...
Rabbie Posted October 18, 2007 Author Share Posted October 18, 2007 I guess the problem really is why doesn't ./ work as part of an include path when it is mentioned in the php manual. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372632 Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2007 Share Posted October 18, 2007 maybe: I am using PHP with Windows not sure. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372643 Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 Just out of curiosity which version of phpMyAdmin are you working with? I was able to come across bug reports involving the include path in a few versions. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372650 Share on other sites More sharing options...
brettpower Posted October 18, 2007 Share Posted October 18, 2007 <deleted> Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372656 Share on other sites More sharing options...
Rabbie Posted October 18, 2007 Author Share Posted October 18, 2007 I am using phpMyadmin 2.11.0 I don't think it is an issue with phpmyadmin as I can create the problem in a test script. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-372717 Share on other sites More sharing options...
Rabbie Posted October 20, 2007 Author Share Posted October 20, 2007 Anyone else able to explain why include(./dir/file.php) doesn,t work but include("dir/file.php") does work. Quote Link to comment https://forums.phpfreaks.com/topic/73841-include_path-problems/#findComment-373855 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.