The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Site Relative Links pointing to wrong directory

Discussion in 'General Discussion' started by jimmshepard, Aug 21, 2004.

  1. jimmshepard

    jimmshepard Member

    Joined:
    Aug 14, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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,
     
  2. jimmshepard

    jimmshepard Member

    Joined:
    Aug 14, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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...
     
  3. jimmshepard

    jimmshepard Member

    Joined:
    Aug 14, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    Still not working... Anybody have any suggestions as to where I can look? Anybody even heard of this happening before?

    Thanks,
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    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.
     
  5. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Just to make things a bit easier for you to understand, this won't work because with PHP include, a / at the start means from the SERVER root, not your ACCOUNT root.
     
    sawbuck likes this.
  6. jimmshepard

    jimmshepard Member

    Joined:
    Aug 14, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  7. gunmuse

    gunmuse Well-Known Member

    Joined:
    Jul 3, 2003
    Messages:
    98
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    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.
     
  8. gorilla

    gorilla Well-Known Member

    Joined:
    Feb 3, 2004
    Messages:
    699
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Sydney / Australia
    #8 gorilla, Nov 17, 2004
    Last edited: Nov 17, 2004
  9. gunmuse

    gunmuse Well-Known Member

    Joined:
    Jul 3, 2003
    Messages:
    98
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    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.
     
Loading...

Share This Page