Results 1 to 19 of 19
  1. #1
    Join Date
    Dec 2006
    Posts
    288

    Unhappy PHP issue. Help!

    RedHat Box
    Apache 2.0.52
    php 4.3.9

    On a much larger scale, but here is the code that basically will not work (Browser gives "Internet Explorer cannot display the webpage") and there is no messages in the error_logs.

    <html>
    <head></head>
    <body>
    test test
    <?php include("http://www.ANYDOMAIN.com/test"); ?>
    </body>
    </html>

    Also there is a index.php file in http://www.ANYDOMAIN.com/test

    Works on a friends server, but not this one. Any thoughts of why?

  2. #2
    Join Date
    Jan 2008
    Location
    India
    Posts
    46

  3. #3
    Join Date
    Apr 2002
    Posts
    930
    Try using a different browser other than Internet Explorer. Internet Explorer has a tendency to give out their personal error pages which aren't always as helpful as the real error page.

  4. #4
    Join Date
    Dec 2006
    Posts
    288
    I changed the file to 777. Same results. Tried it in Firefox and got the "blank screen". I hope someone can make sense of this, because it is not making any sense to me...

  5. #5
    Join Date
    Oct 2002
    Location
    State of Disbelief
    Posts
    22,951
    Don't you need to specify a file, and not just a directory when doing an include?
    Having problems, or maybe questions about WHT? Head over to the help desk!

  6. #6
    Join Date
    Dec 2006
    Posts
    288
    Quote Originally Posted by bear View Post
    Don't you need to specify a file, and not just a directory when doing an include?
    Tried it both ways and get the same result. Also, tried it both ways on my friends server and both times it was successful. Has to be something with my server, but can't figure out what.

  7. #7
    Join Date
    Oct 2002
    Location
    State of Disbelief
    Posts
    22,951
    From php,net regarding includes:
    If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
    Having problems, or maybe questions about WHT? Head over to the help desk!

  8. #8
    Join Date
    Dec 2006
    Posts
    288
    By the way, changed the file permissions on both the included file and the calling file to 777. No success!

  9. #9
    Join Date
    Dec 2006
    Posts
    288
    Quote Originally Posted by bear View Post
    From php,net regarding includes:
    I'm not finding a "URL fopen wrappers" variable in my phpinfo. Is it located elsewhere? I do have an "allow_url_fopen" that is currently set to ON. Should this be set to off?

  10. #10
    Join Date
    Apr 2002
    Posts
    930
    What happens if you leave out the PHP?

    HTML Code:
    <html>
    <head></head>
    <body>
    test test
    </body>
    </html>
    If there is a problem with the PHP segment, it looks like you should at least get the test test part that is displayed in your HTML body.

  11. #11
    Join Date
    Dec 2006
    Posts
    288
    I think we are getting somewhere. If I change to the code to:

    <html>
    <head></head>
    <body>
    html html
    <?php include("/usr/local/apache/sites/client/domainname.com/htdocs/test/index.php"); ?>
    </body>
    </html>

    I get success. Now the question is, is how do I get it to use the URL?

  12. #12
    Join Date
    Dec 2006
    Posts
    288
    Quote Originally Posted by SPaReK View Post
    What happens if you leave out the PHP?

    HTML Code:
    <html>
    <head></head>
    <body>
    test test
    </body>
    </html>
    If there is a problem with the PHP segment, it looks like you should at least get the test test part that is displayed in your HTML body.
    I get the "test test". But if I leave the php in, I get "Internet Explorer cannot display the webpage".

  13. #13
    Join Date
    Apr 2002
    Posts
    930
    If the website is hosted on the same physical server as the current server, the question becomes why do you want to access it through a URL? Its much more efficient to include the file through a file system path. If the website is on the same physical server and you are including the path via a URL then you are just going to bog down the server when the page gets a lot of hits. You would effectively be generating twice the load on the server as you would calling it through a file system path.

  14. #14
    Join Date
    Dec 2006
    Posts
    288
    I couldn't agree with you more! Unfortunately, this is a fairly large site and my clients webmaster has done it this way on way too many pages to change. Plus my client is aware that it works on another server. So I need to come up with the solution. I'm fairly sure it just a configuration issue, but I don't know what config to change and to whatt?

  15. #15
    Join Date
    Apr 2002
    Posts
    930
    You need to enable allow_url_include in your php.ini file or set up a personal php.ini for the account.

    I would really stress with the developer that this is not the way to go. This really just contributes to a lot of the problems with a lot of PHP scripts. Developers seem to disregard security and efficiency and focus solely on a method that works easier for them. I just don't think programming something like this is a good idea.

  16. #16
    Join Date
    Dec 2006
    Posts
    288
    I intend too! Thanks!

    I put the following in the Virtual Host file:
    php_admin_flag allow_url_include On

    as I didn't want to affect all the domains. Restarted Apache. It still isn't allowing it. So I put:
    allow_url_include = On
    in the php.ini and restarted Apache. Still didn't allow it.

    I appreciate your help! Any other suggestions?

  17. #17
    Join Date
    May 2006
    Location
    India
    Posts
    661
    A couple of possibilities that i can think of

    1) The site in question ( www.ANYDOMAIN.com ) is NOT resolving within the server.
    2) allow_url_fopen turned off.
    3) Outbound port 80 connections are blocked in server's firewall.
    SparkSupport.Com - The Premier Tech Company
    Cloud Solutions|Email Infra setup|VOIP|Video Streaming|Software Development
    Email: [email protected] Phone : 1- 408-600-1449 | Skype : shijils

  18. #18
    Join Date
    Apr 2002
    Posts
    930
    Apparently allow_url_fopen also has to be enabled.

  19. #19
    Join Date
    Dec 2006
    Posts
    288
    Quote Originally Posted by SparkSupport View Post
    A couple of possibilities that i can think of

    1) The site in question ( www.ANYDOMAIN.com ) is NOT resolving within the server.
    2) allow_url_fopen turned off.
    3) Outbound port 80 connections are blocked in server's firewall.
    Nice suggestions.

    1. I can ping www.ANYDOMAIN.com from within the server.
    2. According to the documentation allow_url_fopen must be on
    3. I changed the firewall settings to allow port 80 in and out. I also disable the firewall to see if the firewall was creating the issue.

    So that being all said. Here's the fix.

    Virtual host file has:
    php_admin_flag allow_url_fopen Off
    php_admin_flag allow_url_include On


    I figured I'd give your #2 a try and it worked!!! Don't know why but it did!

    Many Thanks for everyones help here! This is why this place is the best! Hopefully someday I will be able provide help to someone, like everyone here has for me! Thanks again!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •