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.

Currently no errors anywhere, when I visit a php page in my browser, it just outputs the php code to the browser,

I have a .htaccess file with the following

AddType application/x-httpd-php .php

php still not running, php -v shows php installed: PHP 5.3.10 (cli) (built: Feb 4 2012 07:36:51) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

I just need to get apache to execute the php code.

share|improve this question
    
php -v shows the CLI version of PHP. Could you check that Apache knows about the PHP extension with apache2ctl -M? –  Ladadadada Apr 9 '12 at 17:36

1 Answer 1

If you have php installed try to create php configuration in /etc/httpd/conf.d/php.conf:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# 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

It should be included by default on redhat like distros. (you can check it yourself if you have Include conf.d/*.conf in your httpd.conf.

Adding this sort of configuration to .htaccess is not a best idea imo and should be staticly placed in *.conf files... are you sure that AllowOverride is not set to None?

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.