Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Problem with php and apache

I have php 5.1.6 running on my CentOS 5 server running Apache 2.2.3

when i use command php -v it says

PHP 5.1.6 (cli) (built: Nov 29 2010 16:47:46) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

and after creating a my_file.php on var/www/html folder and running command

php -f my_file.php i got the output as "Hello World!"

all fi9 till here but when i upload file through filezilla on server and run the pages through browser then php instead of getting parsed just get printed in the form of simple text.

I am not able to see any LoadModule of PHP5 on http.conf file and when i add it manually and restart my httpd then my php file instead of being executed, it just get downloaded.

May be any config issue. can any one help me out from this ? Please ask if any other info needed to find the solution.

share|improve this question

marked as duplicate by splattne Aug 1 '11 at 7:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

There's already a bunch of questions from ppl with the same problem. It's most likely a missing addhandler in apache, see – 3molo Aug 1 '11 at 6:54
None of the replies there worked for me. So i posted it again. – Astha Aug 1 '11 at 8:37
up vote 1 down vote accepted

Check that you have defined suitable type and handlers for php. My CentOS system has the following php related definitions

AddHandler php5-script .php
AddType text/html .php
share|improve this answer
Thanks for looking. i have AddHandler application/x-httpd-php .php AddType application/x-httpd-php-source .phps this on my httpd.conf for php config. – Astha Aug 1 '11 at 7:13
I removed my lines and added instead the lines you suggested but problem remained the same. Browser just prints php script as plain text. – Astha Aug 1 '11 at 7:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.