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.

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.


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