Wednesday, April 24, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 8402  / 2 Years ago, mon, july 25, 2022, 3:14:22

I recently reinstalled my whole webserver, and I am now hosting some documents from home for personal use. Now, whenever I go to that page, it automatically downloads the .html and .php documents. I've tried Googling my problems, and no results.


More From » apache2

 Answers
5

Probably Apache does not know what to do with the related files (.php i assume) and offers them for download instead of display.



You can check if the following line exists in your site configuration file:



DirectoryIndex index.html index.php



Usually site configurations are stored at /etc/apache2/sites-available and the enabled configurations (those who actually served by the server) are stored at /etc/apache2/sites-enabled



The rest configuration files, such as apache.conf and ports.conf: are stored at /etc/apache2/ directory.



Also the php module must be loaded. There must something like the following in Apache config file:



LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php
AddType application/x-httpd-php .php


If the above settings are missing, you need to add them yourself and issue:



sudo service apache restart.



For more detailed instructions you can read the Server Guide chapter from the official Ubuntu documentation.


[#29887] Wednesday, July 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
onomicsiberated

Total Points: 217
Total Questions: 98
Total Answers: 107

Location: Luxembourg
Member since Sun, May 28, 2023
12 Months ago
;