Heyo, well, it's basically like this: On my local webserver, it works fine and I get no errors etc. But when I tried to use the script on my webserver I get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/namehere/public_html/index.php:5) in /home/namehere/public_html/steamauth/steamauth.php on line 17
The following is the steamauth.php's line 17 and the lines around it:
$openid = new LightOpenID('localhost');
if(!$openid->mode) {
if(isset($_GET['login'])) {
$openid->identity = 'http://steamcommunity.com/openid';
header('Location: ' . $openid->authUrl()); // LINE 17
}
This is my index.php file:
<?php
require 'steamauth/steamauth.php';
if(!isset($_SESSION['steamid'])) {
echo "welcome guest! please login \n \n";
steamlogin(); //login button
} else {
//Protected content
echo "OMG! You logged in! :D \n";
echo "your steam ID is: " . $_SESSION['steamid'] . "\n"; //prints their steam ID!
logoutbutton();
}
?>
This is what I am trying to use: https://github.com/SmItH197/SteamAuthentication
If anyone could help, I'd love to get the help. I've searched around and tried the different solutions.
IE: PHP header not working for server but works perfectly fine on local host
I've also checked stuff such as is at their correct places, and they're at the beginning/end of the file(s).
you cannot transfer your page through header if there is some output on page before calling it
such as
echo "Yes";
header("location:something.php");
exit;
this will give you the warning like
Warning: Cannot modify header information - headers already sent by (output started at xxxx on line 17
so check on your line no 5
in index.php
there will be some output is printed.
line no 5 on index.php is
echo "welcome guest! please login \\n \\n";
the above is printing on index.php and then you transfering your header. so the error is commes.
I was migrating from WAMPserver to IIS.
Been struggling with this for two days where it worked fine on Production (error reporting off) but not on Localhost (error reporting on)
The moment I switched error reporting OFF on localhost everything ran fine.
When there's Notice errors on the page you're already doomed as headers are then already modified hence the
Warning: Cannot modify header information - headers already sent by (output started at /home/namehere/public_html/index.php:5)
More info on this here: https://wordpress.org/support/topic/localhost-works-fine-but-live-site-generating-header-error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.