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

Does anyone here know why my PHP code is not being interpreted? Apache is running smoothly with localhost, but when I try to execute localhost/info.php containing

?>) ... 

It's not interpreted.

Here is my httpd.conf

Listen 80

LoadModule actions_module modules/
LoadModule alias_module modules/
LoadModule asis_module modules/
LoadModule auth_basic_module modules/
#LoadModule auth_digest_module modules/
#LoadModule authn_alias_module modules/
#LoadModule authn_anon_module modules/
#LoadModule authn_dbd_module modules/
#LoadModule authn_dbm_module modules/
LoadModule authn_default_module modules/
LoadModule authn_file_module modules/
#LoadModule authnz_ldap_module modules/
#LoadModule authz_dbm_module modules/
LoadModule authz_default_module modules/
LoadModule authz_groupfile_module modules/
LoadModule authz_host_module modules/
#LoadModule authz_owner_module modules/
LoadModule authz_user_module modules/
LoadModule autoindex_module modules/
#LoadModule cache_module modules/
#LoadModule cern_meta_module modules/
LoadModule cgi_module modules/
#LoadModule charset_lite_module modules/
#LoadModule dav_module modules/
#LoadModule dav_fs_module modules/
#LoadModule dav_lock_module modules/
#LoadModule dbd_module modules/
#LoadModule deflate_module modules/
LoadModule dir_module modules/
#LoadModule disk_cache_module modules/
#LoadModule dumpio_module modules/
LoadModule env_module modules/
#LoadModule expires_module modules/
#LoadModule ext_filter_module modules/
#LoadModule file_cache_module modules/
#LoadModule filter_module modules/
#LoadModule headers_module modules/
#LoadModule ident_module modules/
#LoadModule imagemap_module modules/
LoadModule include_module modules/
#LoadModule info_module modules/
LoadModule isapi_module modules/
#LoadModule ldap_module modules/
#LoadModule logio_module modules/
LoadModule log_config_module modules/
#LoadModule log_forensic_module modules/
#LoadModule mem_cache_module modules/
LoadModule mime_module modules/
#LoadModule mime_magic_module modules/
LoadModule negotiation_module modules/
#LoadModule proxy_module modules/
#LoadModule proxy_ajp_module modules/
#LoadModule proxy_balancer_module modules/
#LoadModule proxy_connect_module modules/
#LoadModule proxy_ftp_module modules/
#LoadModule proxy_http_module modules/
#LoadModule proxy_scgi_module modules/
#LoadModule reqtimeout_module modules/
LoadModule rewrite_module modules/
LoadModule setenvif_module modules/
#LoadModule speling_module modules/
#LoadModule ssl_module modules/
#LoadModule status_module modules/
#LoadModule substitute_module modules/
#LoadModule unique_id_module modules/
#LoadModule userdir_module modules/
#LoadModule usertrack_module modules/
#LoadModule version_module modules/
#LoadModule vhost_alias_module modules/

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>

User daemon
Group daemon



DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

 <Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

 <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all


<IfModule dir_module>
   DirectoryIndex index.html index.htm index.php

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    CustomLog "logs/access.log" common


<IfModule alias_module>

    ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"


<IfModule cgid_module>


<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

DefaultType text/plain

<IfModule mime_module>

    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz


<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

Thank you all !

share|improve this question

migrated from Aug 26 '12 at 10:59

This question came from our site for professional and enthusiast programmers.

check your error_log of apache – atmon3r Aug 25 '12 at 15:40
You really should read the PHP manual, it explains everything. – Jocelyn Aug 25 '12 at 15:44

1 Answer 1

You'll need to add directives to configure the php module. This is what the configuration directives look like on CentOS 6.x. Your system may be slightly different.

# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
<IfModule prefork.c>
  LoadModule php5_module modules/
<IfModule worker.c>
  LoadModule php5_module modules/

# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php
share|improve this answer

Your Answer


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