-   Linux - Server (
-   -   PHP installed but not executing when in browser on CentOS server (

saxophonemaster 06-18-2012 01:51 AM

PHP installed but not executing when in browser on CentOS server
I have installed php on my centos browser, but now it appears that it is not working. (I don't know at what point it no longer worked). I created a page called phpTest.php with just a phpinfo() script and it produces a blank page. Is there something within my httpd.conf file I need to add or should I try reinstalling php? (If I should try reinstalling - how do I uninstall it first).


Didier Spaier 06-18-2012 02:10 AM

To check that php be properly installed, please post output of following command typed in a terminal:

which php
Also, check that your configuration files are properly set up, mainly:

Especially, in /etc/httpd/httpd.conf following line should not be commented:

Include /etc/httpd/mod_php.conf

saxophonemaster 06-18-2012 11:57 PM

So the result of which php is

So I don't see a mod_php.conf, but I do see a php.conf in /etc/httpd/conf.d/php.conf
The php.ini file is at /etc/php.ini
And the httpd file is at /etc/httpd/conf/httpd.conf

There is a line in the httpd file that says:

Include conf.d/*.conf
which should include the right files, right?

---------- Post added 06-18-12 at 10:58 PM ----------

Also the server root is /etc/httpd

routers 06-19-2012 01:43 AM

before .php is that any .html work in the browser?
if not then you need to look at chmod things

otherwise paste VirtualHost container

saxophonemaster 06-20-2012 09:55 PM

Yeah, I can access html pages and they load fine. Just php pages won't load.

So the virtual host container is commented out, but is:

#<VirtualHost *:80>
#    ServerAdmin
#    DocumentRoot /www/docs/
#    ServerName
#    ErrorLog logs/
#    CustomLog logs/ common

However the following is through the httpd.conf

ServerRoot "/etc/httpd"
Include conf.d/*.conf
ServerAdmin root@localhost
DocumentRoot "/var/www/html"
DirectoryIndex index.html index.html.var default.htm index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Anything that might be missing?

routers 06-21-2012 12:45 AM

ok looks good for this, and follow this command below


# cd /var/www/html
# echo '<? phpinfo (); ?>' > info.php
# apachectl restart

and point your browser to http://your.ip/info.php

see what happen

frieza 06-21-2012 12:53 AM

posting a copy of your httpd.conf might help

All times are GMT -5. The time now is 11:38 PM.