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

I have recently downloaded and compiled the latest version of PHP on to my server. However, realized I did all of this as root. PHP shows as successfully installed, however php pages do not render, and just display as plain text. Was installing php as root the problem, and if so, do I need to re-install, or is there something I can do?

share|improve this question
    
More details please: web server, configuration directives, etc –  Joel E Salas Mar 15 '12 at 18:38
1  
and why did you compile php ??? PHP in for example remi repo is in quite new versions 5.3.10 i think now. –  B14D3 Mar 15 '12 at 18:47
    
I have since re installed with yum from a repo. still the same problem. shows installed, but does not render any php –  Headspin Mar 15 '12 at 19:03
    
Show yum install command and/or rpm -qa | grep php –  HTTP500 Mar 15 '12 at 19:39
    
php-common-5.3.10-1.w5, php-cli-5.3.10-1.w5, php-5.3.10-1.w5 –  Headspin Mar 15 '12 at 19:44

1 Answer 1

First, you need to restart Apache (I'm assuming that's your webserver since you didn't mention it). If you didn't, that's your problem.

If you already did... It's not all to install PHP, you have to make sure it's properly loaded by apache. The default PHP rpm install will detect Apache and create a php.conf file in /etc/httpd/conf.d. All you gotta do after is restart Apache and it should work.

My php.conf contains this:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
  LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
  LoadModule php5_module modules/libphp5-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

If you don't have a php.conf file in /etc/httpd/conf.d, then look for those lines (the uncommented ones) in your /etc/httpd/conf/httpd.conf file, and make sure the paths are good. If you say you compiled it first and then reinstalled using a package, my guess is that you have conflicting lines (duplicates) pointing to different paths. You should clean that out first and try to restart Apache after.

If it still doesn't work, look in the error log of Apache and see if there's an error. This should tell you more.

share|improve this answer

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.