Jump to content

Fatal Error (include_path='.;C:\xampp\php\pear\')


Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/131141-fatal-error-include_pathcxamppphppear/
Share on other sites

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.

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?

 

 

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.

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).

  • 2 years later...

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.