我有一个使用无穷大虚拟主机的功能良好的脚本。由于某些原因,同一脚本无法在Awardspace虚拟主机上运行。两者都启用php。
我收到的错误消息:
Warning: session_start(): Cannot send session cache limiter - headers already sent [...] line 2
Warning: file_get_contents(http://ipinfo.io/37.76.66.143/json): failed to open stream: Connection refused in [...] line 52
Warning: Cannot modify header information - headers already sent by [..] line 72
脚本开始类似(1-3行):
<?php
session_start();
?>
行(51-53):
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
$locationData = $details->city;
行(68-75):
if($_SESSION['username'] == "admin")
{
header('Location: adminPage.php');
}
else
{
header('Location: landingPage.php');
}