Site Relative Links pointing to wrong directory

jimmshepard

Member
Aug 14, 2003
19
0
151
Chicago
Maybe I'm just an idiot and missing something really simple, but on all of the accounts on my server, site relative links, includes, images do not work unless you give the entire server path...

eg.

include ('/includes/header.php'); doesnt' work
include('/home/user/www/includes/header.php'); does work


Any clues? I know this is probably something simple but I've been searching the boards for two days and I just can't find any answers.

Thanks,
 

jimmshepard

Member
Aug 14, 2003
19
0
151
Chicago
The problem with that is that I am in a higher directory. That makes it document relative and I really don't want to have to code every link as ../../../../../includes/header.php

I transferred a site from another server to my own dedicated server and all the site relative links stopped working.

I get this:

Warning: main(ye/yeheader.php): failed to open stream: No such file or directory in /home/ilstuden/public_html/ye/registration/includes/yeheader.php on line 1

Warning: main(): Failed opening 'ye/yeheader.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilstuden/public_html/ye/registration/includes/yeheader.php on line 1


Thanks for the reply though...
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,466
30
473
Go on, have a guess
There's nothing wrong here. You're using paths, so they will be relative to the location of the script that you are running, as thaphantom said. This has nothing to do with URL's which you seem to be confusing paths with. The implest thing to do is to use absolute paths from /home/yourdomain/public_html/, but if you're going to use relative paths you will need to rework your code to make sure you perform the relative includes correctly.
 

jimmshepard

Member
Aug 14, 2003
19
0
151
Chicago
Ahh... I wasn't aware of that. I thought that I had coded it the other way in the past but obviously I'm mistaken. Thanks for the clarification...I was pulling my hair out as to why the images worked site relative but not the includes.

Thanks again
 

gunmuse

Well-Known Member
Jul 3, 2003
98
0
156
New Mexico
Your not mistaken we were doing the same thing and now having the same problem.

WHY would / mean server root. Who would let their clients access server root?

When you use the / in php it should go to www folder forward. Some at cpanel needs to address why some of the cpanel setups are coming this way and what we do to fix it.
 

gunmuse

Well-Known Member
Jul 3, 2003
98
0
156
New Mexico
Then either my first 4 cpanel boxes were setup "strange" and I don't modify them. Or this new one is.

Now since I don't believe that Ioncube doesn't know how to call a relative path. I do believe this is a cpanel issue.

http://www.firebasesoftware.com/ioncube/ioncube-rtl-tester.php

It reports the relative path as

Relative Path: /../../../../home/firebase/public_html/ioncube/

This is not right. Now without to much more smart ass links maybe the god of code you are attempting to be could explain why php is reporting the wrong relative path.