I am trying to execute a simple php file called tester
:
<!DOCTYPE html>
<body>
<?php
echo '<p>Hello World</p>'
?>
</body>
However, whenever I activate the localhost, the file is downloaded onto my computer instead of executed. I do not know why this is. I have PHP version 5.6.30. I am running Apache on XAMPP as an administrator. My htaccess
file has just this single line: AddType application/x-httpd-php .php
.
Things that I tried and did not work:
- I tried uninstalling and reinstalling XAMPP
- I tried changing
AddType application/x-httpd-php .php
toAddType application/x-httpd-php5 .php
andAddHandler application/x-httpd-php52 .php
respectively - I tried moving the
htaccess
file from the root of the folder into the views, where the html is, as seen below: Before:
folder
|----views
| |
| main.html
.htacces
After:
folder
|
|-views
|
main.html
.htaccess
How can I solve this problem?