Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Just created a new install of Centos 6.0 64-bit on a virtual machine and running on Vmware workstation 8, windows host.

yum install php
service httpd restart

And when trying to run a html file from the var\www\html dir which just has <?php phpinfo(); ?> in it or pointing browser to localhost. Nothing comes up.

Also opened up httpd.conf and added:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Tried reinstalling, installing php-common, then php etc. to no avail. Otherwise going for the typical LAMP.

installed:

php.x86_64              5.3.2-6.el6_0.1 @updates                                
php-cli.x86_64          5.3.2-6.el6_0.1 @updates                                
php-common.x86_64       5.3.2-6.el6_0.1 @updates 

Yet to update to Centos 6.1

PHP5 is probably comes installed by default with Centos and I maybe stuffed it up by running yum install php?

share|improve this question
    
Any relevant httpd logs? –  Khaled Nov 27 '11 at 12:05
    
"And when trying to run a html file" Stupid question, but... does the file have .php extension? –  Selivanov Pavel Nov 27 '11 at 12:13
    
yeah, just added. –  LaserBeak Nov 27 '11 at 12:13
    
Is there any php related stuff in /etc/httpd/conf.d? –  Kevin M Nov 27 '11 at 13:08
add comment

4 Answers

up vote 0 down vote accepted

No need to edit httpd.conf. PHP is includes it's binding from /etc/httpd/conf.d/php.conf, which is included by include directive at httpd.conf. It's enough to check php.conf and ensure that all required lines are not commented. It should work by default with prefork httpd. Probably something was wrong with your php.conf.

share|improve this answer
add comment

try to view the source code of the blank page you see, if it has phpinfo present in it, in plain text, that means php module is not working.(which i think wont be a problem).

Also try to turn off selinux, if it works.

check ownership of the file you have created (index.html)

share|improve this answer
add comment

Solved by doing a complete reinstall of the php packages.

According to Question author

share|improve this answer
add comment

This is likely due to your php files using short php tags <? instead of <?php. By default, short tags are not enabled in the php.ini config file.

share|improve this answer
add comment

Your Answer

 
discard

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.