- HTTP server is installed. You can install XAMPP or WAMP server on your PC. They include Apache for HTTP server, MySQL database, etc. Check out this video to install xampp.
- Your file has .php file extension.
- You are accessing that page via an HTTP server http://localhost/file.php not via local file access file://localhost/www/file.php.
Also learn PHP from begging, here I made a playlist.