Relative paths using include() - not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Relative paths using include() - not working

Postby kevinmack18 » 01. February 2009 23:01

I am having issues with relative paths using Xampp.

Code: Select all
Warning: include("BLAH BLAH") [function.include]: failed to open stream: No such file or directory in "BLAH BLAH"
Warning: include() [function.include]: Failed opening '"BLAH BLAH"' for inclusion (include_path='.;C:\xampp\php\pear\') in "BLAH BLAH"


Is this something I can fix in the php.ini? Or is this just a Windows issue with relative paths? -- if so, what can I do to fix this?

I keep trying everything // Does anyone else have this issue? Or have you ever had this issue?

(I am using Windows XP Pro)


Hope someone can help! Thanks in advance.
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby Izzy » 01. February 2009 23:14

In xampp\apache\bin\php.ini
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;C:\xampp2\php\pear\"
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Relative paths using include() - not working

Postby Wiedmann » 01. February 2009 23:49

Code: Select all
Warning: include("BLAH BLAH") [function.include]: failed to open stream: No such file or directory in "BLAH BLAH"

Or have you ever had this issue?

No, i don't have a PHP file with the name "BLAH BLAH" and have never tried to include to same file into it self.

Hope someone can help!

Too less information to help....
- What is the real error message?
- What is the filesystem location for both files?
- Which file did you access in your browser with which uri?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Relative paths using include() - not working

Postby kevinmack18 » 02. February 2009 00:44

I'm a bit confused by that last post on here.... the "No, i don't have a PHP file with the name "BLAH BLAH" and have never tried to include to same file into it self." post... was this for me? or for someone else? -- Anyway, it was confusing.

"BLAH BLAH" is just a filler for any file in the server's directory.


Is include_path = ".;C:\xampp2\php\pear\" turned off by default? If so, I will give this a try - I will let you know if this works.

Did you have this issue yourself?
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby Izzy » 02. February 2009 00:56

kevinmack18 wrote:Is include_path = ".;C:\xampp2\php\pear\" turned off by default? If so, I will give this a try - I will let you know if this works.
Not turned off by default as can be seen in the code frame above.

The default settings in the php.ini file should work for most correctly coded php scripts.
See this Forum Search

See this Google search for definitions of relative and absolute paths.
Or this Google search for relative paths in php.

The C:\xampp\htdocs\xampp folder contains many examples of includes and all working if you test them.

kevinmack18 wrote:Did you have this issue yourself?
If you mean me, no. Never have I had your include issue with any of hundreds of php scripts in many different versions of XAMPP.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Relative paths using include() - not working

Postby kevinmack18 » 03. February 2009 22:35

Well, I still can't seem to get it to work. This works on my production server host but not with Xampp locally.

hmm. I keep trying to dig and find a solution - besides replacing ALL MY PATHS to the full "c:/"
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby Izzy » 03. February 2009 22:43

Code: Select all
Warning: include("BLAH BLAH") [function.include]: failed to open stream: No such file or directory in "BLAH BLAH"
Warning: include() [function.include]: Failed opening '"BLAH BLAH"' for inclusion (include_path='.;C:\xampp\php\pear\') in "BLAH BLAH"
Can you replace the BLAH BLAH with the actual code, as it is hard to try and imagine what path you are having trouble with and also as much detail as possible as it is impossible to see what you see and what you do from here.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Relative paths using include() - not working

Postby kevinmack18 » 04. February 2009 00:30

Code: Select all
Warning: include() [function.include]: Failed opening '../setup/edit/sets.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\Sites\Working\htdocs\dir\app\call.php on line 3
Warning: include(../setup/edit/sets.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\Sites\Working\htdocs\dir\setup\templates.php on line 3


Here are two separate warnings. The odd thing is that the full path to the php-file is the actual location of the file on my computer ("C:\xampp\htdocs\Sites\Working\htdocs\dir\app\call.php" — exists).
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby kevinmack18 » 07. February 2009 01:56

Any new thoughts on this? I'm still having this issue.

include() is working (for the most part) - but it's really only on simple cases. I checked to make sure "safe mode" was off - and it is.

hmm
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby kevinmack18 » 07. February 2009 03:30

Basically, I have resolved this just by changing code a couple of lines of code. The code did not have errors - it worked perfectly on my Mac, Linux, and my (paid) server. I think that Xampp just might be sensitive, there must be something in the .ini that is causing it to do that. For now, I don't care -- but I'd like to solve it someday.

Thanks for all your help everyone :)
kevinmack18
 
Posts: 6
Joined: 01. February 2009 22:56

Re: Relative paths using include() - not working

Postby Izzy » 07. February 2009 03:41

Thanks for posting back but it would have been nice of you to let us know how you resolved your code issue so as to round off the topic with a result so others searching may also benefit.
Thanks.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 84 guests