Page 1 of 1

Will not ../ include

PostPosted: 29. March 2012 21:04
by Shumba
Wont include unless its in the same folder. :roll:
Its also ignoring my style sheet

Code: Select all
include ('settings.php');

works perfectly

Code: Select all
include ('../../settings.php');

Dose not work perfectly!

Code: Select all
Warning: include(settings.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3

Warning: include() [function.include]: Failed opening 'settings.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3


Iv done a little digging but I didn’t find a fix yet, someone said it might be a setting in XAMPP tho im not sure id know how to fix that even if i knew where it was and what i was changing! (Relatively new to this)

XAMPP control panel V 2.5
XAMPP V 1.7.7
Windows 7 64bit

Re: Will not ../ include

PostPosted: 30. March 2012 18:30
by WilliL
have a look to your error.log, it will show you what's wrong

Re: Will not ../ include

PostPosted: 30. March 2012 19:28
by Shumba
WilliL wrote:have a look to your error.log, it will show you what's wrong


Its ignoring the " ../../ " bit :(
Code: Select all
[Fri Mar 30 19:17:43 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/GryphonScript/Users/UserName/style.css, referer: http://127.0.0.1/gryphonscript/Users/UserName/User%20profile.php
[Fri Mar 30 19:17:43 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/GryphonScript/Users/UserName/username, referer: http://127.0.0.1/gryphonscript/Users/UserName/User%20profile.php
[Fri Mar 30 19:17:43 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/GryphonScript/Users/UserName/01.jpg, referer: http://127.0.0.1/gryphonscript/Users/UserName/User%20profile.php
[Fri Mar 30 19:17:43 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/GryphonScript/Users/UserName/02.jpg, referer: http://127.0.0.1/gryphonscript/Users/UserName/User%20profile.php


The files are located in C:/xampp/htdocs/GryphonScript/
page requesting them located in C:/xampp/htdocs/GryphonScript/Users/UserName/

Also
include ('../../settings.php');
and
include ('../../LoginCookieCheck.php');
don’t appear to get a mention in this log, assuming im looking at the right log :?

Code: Select all
<!DOCTYPE html>
<?php
include ('../../settings.php');
include ('../../LoginCookieCheck.php');
?>
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="../../style.css" TYPE="text/css">
</HEAD>

Re: Will not ../ include

PostPosted: 31. March 2012 21:55
by WilliL
Shumba wrote:
Code: Select all
[Fri Mar 30 19:17:43 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/GryphonScript/Users/UserName/style.css, referer: http://127.0.0.1/gryphonscript/Users/UserName/User%20profile.php


The files are located in C:/xampp/htdocs/GryphonScript/
page requesting them located in C:/xampp/htdocs/GryphonScript/Users/UserName/

Code: Select all
<!DOCTYPE html>
<?php
include ('../../settings.php');
include ('../../LoginCookieCheck.php');
?>
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="../../style.css" TYPE="text/css">
</HEAD>


I'm not sure (I allways wor with absolute links) - try
Code: Select all
<LINK REL=StyleSheet HREF="http://127.0.0.1/gryphonscript/style.css" TYPE="text/css">

If it works, "../" is useble on file funktions and not on link functions

Re: Will not ../ include

PostPosted: 01. April 2012 02:24
by Shumba
Thanks that got the style sheet working!
It added another line to that page "http:// wrapper is disabled in the server configuration"
If that is poke-able ... where do I poke? *rubs hand together* :D :D

Code: Select all
Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include(http://127.0.0.1/gryphonscript/settings.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include() [function.include]: Failed opening 'http://127.0.0.1/gryphonscript/settings.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3

Re: Will not ../ include

PostPosted: 01. April 2012 02:47
by Sharley
If you include the http:// in your url then using the wrapper it may be applied twice like so
Code: Select all
http://http://127.0.0.1/gryphonscript/style.css

So try simply
Code: Select all
127.0.0.1/gryphonscript/style.css in your link

I don't know if that is your issue but might be worth a try.

Re: Will not ../ include

PostPosted: 01. April 2012 18:38
by Shumba
Sharley wrote:If you include the http:// in your url then using the wrapper it may be applied twice like so
Code: Select all
http://http://127.0.0.1/gryphonscript/style.css

So try simply
Code: Select all
127.0.0.1/gryphonscript/style.css in your link

I don't know if that is your issue but might be worth a try.



That killed the style sheet and includes say...
Code: Select all
Warning: include(127.0.0.1/gryphonscript/settings.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3

Warning: include() [function.include]: Failed opening '127.0.0.1/gryphonscript/settings.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3


The stylesheet seams happy with the http:// ... the includeds just dun like anything! lol :lol:

Re: Will not ../ include

PostPosted: 01. April 2012 19:09
by WilliL
Shumba wrote:
Code: Select all
Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include(http://127.0.0.1/gryphonscript/settings.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include() [function.include]: Failed opening 'http://127.0.0.1/gryphonscript/settings.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3

on including a fie use "../" or "c:/xampp/htdocs/..etc"
on linking or refering to a LINK use "http://127.0.0.1/..etc"

Re: Will not ../ include

PostPosted: 01. April 2012 20:52
by Shumba
WilliL wrote:
Shumba wrote:
Code: Select all
Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include(http://127.0.0.1/gryphonscript/settings.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3
Warning: include() [function.include]: Failed opening 'http://127.0.0.1/gryphonscript/settings.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\GryphonScript\Users\UserName\User profile.php on line 3

on including a fie use "../" or "c:/xampp/htdocs/..etc"
on linking or refering to a LINK use "http://127.0.0.1/..etc"


useing this line
Code: Select all
include ('http://127.0.0.1/gryphonscript/settings.php');

Re: Will not ../ include

PostPosted: 01. April 2012 21:31
by WilliL
Shumba wrote:useing this line
Code: Select all
include ('http://127.0.0.1/gryphonscript/settings.php');

here you want to include a file
Code: Select all
include ('c:/xampp/gryphonscript/settings.php');
// or
include  ('../../settings.php');

sorry, I don't know how to explain it better

Re: Will not ../ include

PostPosted: 01. April 2012 22:04
by Shumba
Ok something odd is going on here... :shock:
include ('../../settings.php'); has just started working?! That is exactly how I started before when i wasn’t working and I haven’t altered anything else!

I can only assume there’s something unstable about the software handling this.
I will re-download and reinstall later and let you know if it breaks again.

Worth pointing out that others posts I found here with the same issue didn’t seem to find a fix for it.

For the record the style sheet now also is working with
<LINK REL=StyleSheet HREF="../../style.css" TYPE="text/css">

Re: Will not ../ include

PostPosted: 02. April 2012 18:04
by Altrea
Shumba wrote:I can only assume there’s something unstable about the software handling this.

I assume you are running in some kind of cache issue.
relative paths have always worked in HTML link header.

just my two cents,
Altrea

Re: Will not ../ include

PostPosted: 23. April 2012 21:10
by Theslcguy
Try using assigning your url a variable

For Stylesheet

$url = "http://127.0.0.1/";
<a href="<?php echo $url; ?>gryphonscript/style.css">