Home > Back-end >  I get HTTP error 500 using Apache2 server
I get HTTP error 500 using Apache2 server

Time:11-28

Long stoy short this is my first time doing web dev and I have a project to complete in a course. I have installed php8.1, apache2 (I believe version 2.4) and everything else I needed. When I try to access my website via localhost I get the error 500.

The thing is, the default page of Apache does come up when I open the /html/index.html default folder. When I add my own or swap it with my own it throws me the error. The code is extremely simple so far to avoid any bugs, etc. I know the code works, because I have installed the Live Server Extension in VSCode and when I run my file as a .html file it works. I searched the internet for solutions and maybe it's a corrupt installation or a permissions thing, but I'm way over my head here. I also tried turning my index.php to an index.html, but I still get the same error. I even put everything in comment and only left a single message in the head of the html code. Still I get the error. I don't even try to access other files,etc with PUT or GET commands. I'm lost really, I don't have the knowledge and experience to mess around with a bunch of different installations and permissions to link them all together. At this point I have simply followed a bunch of tutorials to install everything and start coding, but I am unable to code without watching an output. How will I know what I'm doing? Has anyone encountered this problem? What did you guys do?

Here is the code:


<?php 
  //  include 'databaseAPI.php';
?>


<!DOCTYPE html>
<head>
    <h1>My E-Shop</h1>
    <hr>
</head>

<body>
 <!--   <form action="welcome.php" method="post">
        <label for="fname">Username:</label>
        <input type="text" id="username">
        <br><br>
        <label for="lname">Password:</label>
        <input type="password" id="password">
        <br><br>
        <input type="submit" value="Submit">
    </form> -->
</body>

CodePudding user response:

See apache/php error log Use Error Reporting options to see actual errors Run php locally to reproduce and see error just a 500 is never enough to find out what's wrong

  • Related