How to open php files through localhost?

I am a high schooler who wants to learn how to code. I am developing a student management program with xampp, php, mySQL, and Apache. When I opened my index.html file with localhost: localhost/superschool/index.html, the site address changed into localhost/superschool/index.php. This shows up this error messages:HTTP ERROR 500 with console message: (index):7290 crbug/1173575, non-JS module files deprecated.I'm not sure why this happened. Would you please give me an insight to solve this problem? Thank you so much! Here's my index.html and index.php files for the references.

index.html

<html> <head> <meta http-equiv="Refresh" content="0;url=index.php"> <title>Loading ...</title> </head> <body></body>
</html>

index.php

 error_reporting(E_ERROR | E_WARNING | E_PARSE); $currDir = dirname(__FILE__); include("{$currDir}/defaultLang.php"); include("{$currDir}/language.php"); include("{$currDir}/lib.php"); $x = new DataList; $x->TableTitle = $Translation['homepage']; $tablesPerRow = 2; $arrTables = getTableList(); // according to provided GET parameters, either log out, show login form (possibly with a failed login message), or show homepage if(isset($_GET['signOut'])){ logOutUser(); redirect("index.php?signIn=1"); }elseif(isset($_GET['loginFailed']) || isset($_GET['signIn'])){ if(!headers_sent() && isset($_GET['loginFailed'])) header('HTTP/1.0 403 Forbidden'); include("{$currDir}/login.php"); }else{ include("{$currDir}/main.php"); }
7

1 Answer

Try running this command First, you'll need to install PHP

pkg install php

pkg upgrade php

Pkg update php

Make sure you upgrade and update it!

Move over the directory were your php file is located and type this commands

php -S localhost:8080

You could change the port to your own choice...

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like