jrp91384 Posted November 3, 2008 Share Posted November 3, 2008 Hello, I'm receiving the following errors and was hoping someone could help. I have been working on this all day and can not find a solution. When I first entered the code I had no problems. But now for some reason it will not work when trying to view the page. The warning says no such file or directory but it is there. I think the problem pertains to (include_path='.;C:\xampp\php\pear\') but not sure. Warning: require(/home/visolio/public_html/secure/billing/configuration.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\Visolio_Clients\visolio_root\Scripts\phpscripts\announcment.php on line 22 Fatal error: require() [function.require]: Failed opening required '/home/visolio/public_html/secure/billing/configuration.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\Visolio_Clients\visolio_root\Scripts\phpscripts\announcment.php on line 22 Quote Link to comment Share on other sites More sharing options...
corbin Posted November 3, 2008 Share Posted November 3, 2008 Looks like you have an absolute path and need to change it. Quote Link to comment Share on other sites More sharing options...
jrp91384 Posted November 3, 2008 Author Share Posted November 3, 2008 Sorry, dumb question but change which part? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 3, 2008 Share Posted November 3, 2008 First check, where is configuration.php located in relation to announcement.php Quote Link to comment Share on other sites More sharing options...
jrp91384 Posted November 3, 2008 Author Share Posted November 3, 2008 configuration.php is located in a subdomain named secure. announcement.php is in the main domain. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 3, 2008 Share Posted November 3, 2008 Umm, hang on. You're using a *nix file path when you're using Windows! This a *nix file path /home/visolio/public_html/secure/billing/configuration.php This is a Windows file path C:\xampp\htdocs\Visolio_Clients\visolio_root\Scripts\phpscripts\announcment.php On windows absolute file paths must start with a drive letter. Quote Link to comment Share on other sites More sharing options...
jrp91384 Posted November 4, 2008 Author Share Posted November 4, 2008 The nix file path refers to my external server. The Windows file path is referring to my testing server that is just a shared location on my window machine using xampp. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 4, 2008 Share Posted November 4, 2008 But the code is being ran from your windows machine. The error can only be fixed by changing the path from a *nix path to a windows path. PHP won't know that the file being required is on an external server. Quote Link to comment Share on other sites More sharing options...
jrp91384 Posted November 4, 2008 Author Share Posted November 4, 2008 If I understand correctly, I would have to change file paths when testing on my widows machine and then prior to uploading the files to the external server I would have to re-adjust the file paths for it to properly work. And a way around this hassle would be to not share the pc as a testing server but rather have another machine/server for building and testing purposes allowing me to build and upload the final product without changing paths in the scripts. Is this correct? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 4, 2008 Share Posted November 4, 2008 Any configuration information that would change based on where an application is being executed should be contained in a configuration file. Then you only change (use separate configuration files) the configuration file to tailor the application to the environment it is in. I believe I saw that php under Windows correctly converts / in paths. The path you are using in your include must be "logically" connected to the windows operating system so that it can be reached through the file system calls to open and read the include file. Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 5, 2008 Share Posted November 5, 2008 I believe I saw that php under Windows correctly converts / in paths. It does. Besides there's realpath() function, that converts all (back)slashes to the symbols OS is using (and also converts relative paths to absolute paths). Quote Link to comment Share on other sites More sharing options...
john_doews Posted May 13, 2011 Share Posted May 13, 2011 I really hope you managed to solve the problem. As I was facing the same problem now, I found a very easy solution: just add ".." before the location in your php script. I suppose this would be: '../home/visolio/public_html/secure/billing/configuration.php' in the above example. I hope this will be useful to someone else in the future. john Quote Link to comment Share on other sites More sharing options...
requinix Posted May 13, 2011 Share Posted May 13, 2011 A whole thread about file paths without any mention of $_SERVER["DOCUMENT_ROOT"], __FILE__, or __DIR__? [edit] A whole thread from 2008. Sorry, just noticed. Too bad posts can't be deleted... Quote Link to comment Share on other sites More sharing options...
john_doews Posted May 13, 2011 Share Posted May 13, 2011 right, I used $_SERVER["DOCUMENT_ROOT"] in my setting. I seem to have wrongly assumed it was obvious to anyone ... Quote Link to comment Share on other sites More sharing options...
Maq Posted May 13, 2011 Share Posted May 13, 2011 @john_doews, the last reply to this thread (besides yours obviously) is from November 05, 2008. Please don't resurrect old threads and if you have a similar problem then you should start your own thread. Quote Link to comment Share on other sites More sharing options...
john_doews Posted May 13, 2011 Share Posted May 13, 2011 right, don't bother to block me. i'm out of here! 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.