Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

My setup:

# grep php /etc/httpd/conf/httpd.conf 
LoadModule php5_module  modules/libphp5.so
AddType x-httpd-php .php
AddHandler php5-script .php

# grep PHP /etc/httpd/conf/httpd.conf 
PHPIniDir /etc/

# grep open_tag /etc/php.ini 
; short_open_tag
short_open_tag = On

# /etc/init.d/httpd start
Starting httpd: [Tue Dec 04 03:26:29 2012] [warn] module php5_module is already loaded, skipping
httpd: apr_sockaddr_info_get() failed for holdsworth
httpd: Could not reliably determine the server's fully qualified domain name, using for ServerName
                                                           [  OK  ]

# cat /var/log/httpd/error_log 
[Tue Dec 04 03:26:37 2012] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Tue Dec 04 03:26:37 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Dec 04 03:26:37 2012] [warn] module php5_module is already loaded, skipping
[Tue Dec 04 03:26:45 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 04 03:26:45 2012] [notice] Digest: done
[Tue Dec 04 03:26:53 2012] [warn] ./mod_dnssd.c: No services found to register
[Tue Dec 04 03:26:53 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
[Tue Dec 04 03:28:35 2012] [notice] caught SIGTERM, shutting down

access_log is empty. When I open index.php, it shows its content.

[root@holdsworth steve]# ls -lah /var/www/html/php/index.php 
-rwxrwxrwx. 1 root root 1.7K Oct 31 18:38 /var/www/html/php/index.php
share|improve this question

Appears you have both suEXEC and SELinux enabled, so you will need to hack around to permit execution of the php script, to start off check CGI scripts are permitted:

getsebool -a | egrep 'cgi|builtin_scriptin'

If not:

setsebool -P httpd_enable_cgi 1
setsebool -P httpd_builtin_scripting 1

Also check the php scripts have the necessary extended flag, are owned and executable by the apache process, to keep both SElinux and suEXEC happy:

ls -lZ *.php

chcon -t httpd_sys_script_exec_t *.php
chmod +x *.php
chown  xxxx:yyyyyy  *.php

ls -l *.php

Alternatively, if not a public server, disable both.

See: http://beginlinux.com/server_training/web-server/976-apache-and-selinux

share|improve this answer

First, I think you should find where you're loading mod_php a second time:

[warn] module php5_module is already loaded, skipping

I am very superstitious about Apache config files with warning messages - they mean more than they say sometimes.

Second, try a different way of getting mod_php to parse files:

<IfModule php5_module>
    <FilesMatch "\.php$">          
        SetHandler application/x-httpd-php

Lastly, consider where you put the directive(s) to mod_php: if you've got VirtualHost directives, you may have to enable mod_php inside that.

share|improve this answer

I used your configuration file and added below contents to the end of httpd.conf file. addType, AddHandler, PHPIniDir.

And it works for me on CentOS 5, without showing the contents of index.php.

share|improve this answer
up vote 0 down vote accepted

The solution was to clear browser cache, i.e. Press CTRL-F5

php was working, but browser was giving me old version of php content.

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.