Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have files in public_html (index.html). When I go to the main page it gives me "Apache Test Page". When I try to add link to them manually (domain_name/index.html or index2.php) it gives me only code, like in .txt editor. I would really appreciate any help.

share|improve this question
is it showing correctly formatted html files as text? (because that would suggest some other mime-type problem, i.e. apache is sending html files as text/plain) – Tom H May 28 '12 at 16:27
Please specify the operating system you're using, as well as the version of PHP currently installed. Quite likely this is simply a matter of mod_php not being installed or correctly configured. – Richard Keller May 28 '12 at 21:42

you would need to ensure that the php is installed correctly. See the output of apachectl -M and look for php5_module (shared):

# apachectl -M
 core_module (static)
 mpm_prefork_module (static)
 php5_module (shared)   <---here, need this
 dav_svn_module (shared)
 authz_svn_module (shared)
Syntax OK

This last step is generally achieved by installing the php package, which contains support for configuring php module in httpd automatically.

Then check that php-script is configured as the php interpreter is used for scripts with the php suffix;

<IfModule prefork.c>
  LoadModule php5_module modules/

AddHandler php5-script .php
AddType text/html .php

on centos these directives show up in /etc/httpd/conf.d/php.conf and restart apache2.

share|improve this answer
When I write in command shell: apachectl -M. It gives me that: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 57 of /etc/httpd/conf.d/httpd.conf: ServerRoot must be a valid directory. 57 line: ServerRoot "/etc/httpd" 221 line: Include conf.d/*.conf – Mark May 28 '12 at 16:44

It certainly looks like that your apache installation is configured to load mime module.

Please run

# apachectl -M | grep mime

and check if you can see any mime module in the list. If not, then install the mime module. Please have a look at this,

Generally apache ships with mime module and you may not need to recompile it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.