从旧服务器迁移到在CentOS6.4上运行的WHM / cPanel后,ExpressionEngine2出现问题。 简单的testing代码来重现该问题:
<?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'); ?>
其中header.html的样子
<!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>
和footer.html看起来像:
</body> </html>
创buildApache超时:
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
任何线索Apache或PHPconfiguration有什么错误?
谢谢
没什么可能。 错误消息说明了一切:
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
与远程站点的连接包括超时。 这是某种连接问题; 也许有一个防火墙或路由问题的方式(没有关于你的环境的信息是不可能说的,特别是在两个服务器相互之间的关系)。
如果由于某种原因,您正在使用远程包含访问同一服务器上的文件(为什么要这样做),请尝试使用该服务器上的浏览器来查询自己。 如果你不行的话,apache可能不会在loopback接口上监听,但是你的新hosts文件正在导致域名parsing为127.0.0.1 。