LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP installed but not executing when in browser on CentOS server (http://www.linuxquestions.org/questions/linux-server-73/php-installed-but-not-executing-when-in-browser-on-centos-server-4175411997/)

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).

Thanks,
Travis

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:
Code:

which php
Also, check that your configuration files are properly set up, mainly:
/etc/httpd/modf_php.conf
/etc/httpd/php.ini
/etc/httpd/httpd.conf

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

Include /etc/httpd/mod_php.conf

saxophonemaster 06-18-2012 11:57 PM

So the result of which php is
Code:

/usr/bin/php
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:
Code:

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:
Code:

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

However the following is through the httpd.conf
Code:

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

Code:

# 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 03:15 PM.