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.

Allowing Full URL PHP Includes?

Discussion in 'General Discussion' started by Parahosting, Apr 8, 2007.

  1. Parahosting

    Parahosting Well-Known Member

    Joined:
    Apr 6, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    I'm currently using PHP 5.2.1 on Apache 1.3.7 on CentOS 4.4. The problem I have is that I can't allow Full URL including via PHP. Example:


    Code:
    <?include("http://file.txt"); ?>
    

    And after checking my PHP.ini, "allow_url_fopen = On" is what I find in my configuration. What do you think the error for this case is? Do I set the on to TRUE instead and see?
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Did you actually read what you just posted?
    Code:
    http://file.txt
    
    That's not a valid URL !!!!!!
     
  3. Parahosting

    Parahosting Well-Known Member

    Joined:
    Apr 6, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    You're not understanding my post. that's the whole url to a text file. If you're here to evaluate what I posted, then you're not helping in any way.
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    No, that is NOT the whole url and I understand your post perfectly ...

    If you are are going to reference a file for include on the same server as
    the script that you are executing, you would pass by path and file reference:

    Code:
    include("/home/mylogin/public_html/file.txt");
    
    If the file you are including is located on another server or web site,
    then you need to use the URL including the web address:

    Code:
    include("http://www.targetdomain.com/file.txt");
    
    Instead of either of the above, you put the following:
    Code:
    include("http://file.txt");
    
    That is not a valid URL! The "http://" tells the PHP parser that the
    included file is going to be pulled from the internet but there is nothing
    but a filename passed after that so your PHP parser has absolutely
    no idea where it is supposed to connect to on the web!

    You can't just pass a filename without a web address if using "http://" !!!

    If you are just going to put a filename only then you need to drop the "http://"
     
  5. Parahosting

    Parahosting Well-Known Member

    Joined:
    Apr 6, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Alright then, it's an example. So as for my problem, what do you think I can do as a solution?
     
  6. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    The problem is, your example was badly broken and would never have worked. We suspect that the broken URL is the problem, not the server settings.

    So, what is the URL you're trying to use? Change the domain name if you like, but leave everything else exactly as it is.
     
  7. Parahosting

    Parahosting Well-Known Member

    Joined:
    Apr 6, 2007
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Code:
    <?include("http://www.targetsite.com/top.txt);?>
    
    It says Full URL opening is not allowed on the server. I don't have the error no more, but if I did I would show it. This has nothing to do with file existence, because I checked and found the file being existent.
     
  8. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Add this under your allow_url_fopen = On directive to keep it neat...

    allow_url_include = On

    restart apache of course.
     
Loading...

Share This Page