JasonDavis
JasonDavis

Reputation: 48983

How to stop PHP source from being printed to my browser?

I just downloaded this "PHP Code Snippet Library" scrpt from http://www.sourceforge.net/projects/php-csl/ , when I try to run it from my local dev server, all the PHP on every page is output as PHP code, instead of compiling and running the code it seems to show the source of the PHP to the screen. I have never had this happen before, how can I fix this or what cause this?

Upvotes: 0

Views: 385

Answers (2)

John Himmelman
John Himmelman

Reputation: 22010

EDIT: Before reading this post, I'm assuming that... 1. Your test php script has the proper file extension (filename.php) 2. Your test php script isn't using short tags, the abbreviated method, of entering into php ("

You need to make sure the php module is installed and working before you push your website to production. [b]If you're seeing the php code as text in the browser, php is not installed properly[/b]. If the php module for apache isn't enabled apache won't know how to handle php files and will return the php file as plain text.

Upvotes: 0

prodigitalson
prodigitalson

Reputation: 60413

The only reason i can think of that that would happen would be if PHP wasnt installed or if the code was using short tags and they arent enabled on your box.

Upvotes: 3

Related Questions