Check and add parameters if needed into httpd.conf:
# Make sure there's only **1** line for each of these 2 directives: # Use for PHP 4.x: #LoadModule php4_module modules/libphp4.so #AddHandler php-script .php # Use for PHP 5.x: LoadModule php5_module modules/libphp5.so AddHandler php5-script .php # Add index.php to your DirectoryIndex line: DirectoryIndex index.html index.php AddType text/html .php # PHP Syntax Coloring # (optional but useful for reading PHP source for debugging): AddType application/x-httpd-php-source phps
Note 1: The php documentation recommends AddType application/x-httpd-php php instead of the above. However, it causes problems with the “MultiViews” feature of HTTP. That is, if the .php extension is left off a URL, and with certain browser Accept headers, Apache will not know .php (application/x-httpd-php) is HTML and will return a 406 Not Acceptable error. Using the AddType and AddHandler as shown above fixes this problem.
$ /usr/local/apache/bin/httpd -t Syntax OK $ /usr/local/apache/bin/httpd -v Server version: Apache/2.2.2 Server built: May 29 2006 12:40:55 $ /usr/local/apache/bin/httpd -V Server version: Apache/2.2.2 Server built: May 29 2006 12:40:55 Server's Module Magic Number: 20051115:2 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/usr/local/apache" -D SUEXEC_BIN="/usr/local/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" $ /usr/local/apache/bin/httpd -S VirtualHost configuration: . . . $ /usr/local/apache/bin/httpd -l Compiled in modules: core.c . . . mod_so.c $ /usr/local/apache/bin/httpd -M Loaded Modules: . . . php5_module (shared) Syntax OK (the above works for Apache 2.2.x and higher only) $ ps -ef |grep httpd root 24069 1 0 09:17 ? 00:00:08 /usr/local/apache/bin/httpd -k s apache 29917 24069 0 15:30 ? 00:00:00 /usr/local/apache/bin/httpd -k s . . .