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.

Apache time out on PHP include() or file_get_contents() through HTTP

Discussion in 'EasyApache' started by InteractM, Apr 9, 2013.

  1. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    133
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I have a problem with ExpressionEngine2 after moving from an old server to WHM/cPanel. Simple test code to reproduce that issue (childrensmedgroup2.com/test/):

    PHP:
    <?php
    $protocol 
    strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE 'http' 'https';
    $host $_SERVER['HTTP_HOST'];
    include(
    $protocol '://' $host '/header.html');
    ?>
    <p> Main text...</p>
    <?php
    include($protocol '://' $host '/footer.html');
    ?>
    Where header.html looks like

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>


    and footer.html looks like:

    Code:
    </body>
    </html>
    Creates Apache time out:

    Code:
    Quote:
    
    Warning: include(http://www.domain.com/header.html) [function.include]: failed to open stream: Connection timed out in /home/domain/public_html/test/index.php on line 5
    
    Warning: include() [function.include]: Failed opening 'http://www.domain.com/header.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/test/index.php on line 5
    
    Main text...
    
    Warning: include(http://www.domain.com/footer.html) [function.include]: failed to open stream: Connection timed out in /home/domain/public_html/test/index.php on line 12
    
    Warning: include() [function.include]: Failed opening 'http://www.domain.com/footer.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/test/index.php on line 12
    
    Same problem when I use file_get_contents() instead include().

    Any clue what can be wrong with Apache or PHP configuration?

    Thanks
     
  2. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    133
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Looking for help on Apache/PHP issue

    Issue is described here: forums.cpanel.net/f442/apache-time-out-php-include-file_get_contents-through-http-336542.html

    Looking for help on that.
     
Loading...

Share This Page