简体   繁体   中英

XAMPP Server Error (Error 500)

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. If you think this is a server error, please contact the webmaster. Error 500 localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30

I opened the log error and found out that the issue is about the header() i have in my user.inc.php:

function getLogin($conn){
if(isset($_POST['login']))
{
    $uid=$_POST['uid'];
    $pwd=$_POST['pwd'];

    $sql= "SELECT * FROM user WHERE uid='$uid' AND pwd ='$pwd'";
    $result=$conn->query($sql);
    if (mysqli_num_rows($result) == 1){
        if($row = $result->fetch_assoc()){

                $_SESSION['id'] = $row['id'];
                header("Location : index.php?loginsuccess");
                exit();
        }
    }
    else{



    }
}
}

The error log :

[Tue Jul 25 10:26:58.464402 2017] [http:error] [pid 2380:tid 1656] [client ::1:49602] AH02429: Response header name 'Location ' contains invalid characters, aborting request, referer: http://localhost/tgss/index.php

Please, help.

Change this

header("Location : index.php?loginsuccess");

to this

header("Location: index.php?loginsuccess");

The error came from the space between Location and the colon ( : ).

I tested your header("Location : index.php?loginsuccess"); that have space between the colon ( : ), and it also return an Error 500

header("Location : index.php?loginsuccess");

Use below one

header("Location: index.php?loginsuccess");

It gives error only space between Location and : so remove the space like this Location :

Try change

header("Location : path");

To

header("Location: path");

header("Location: path"); path like login.php 'L' of Location should be capital no gap b/w 'Location' and ':'

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM