Sign in to follow this  
Concentrate

Help, browser is not parsing php file?

Recommended Posts

I have a simple php file that has this :
[code]
<?php
phpinfo();
?>
[/code]

I wrote it in a text file but saved it with an .php extension. But when I run it, the browser just spits out the code and does nothing? How can I fix this?

Share this post


Link to post
Share on other sites
Web browsers don't parse php code, web servers parse php code and send html (or scripts) to the web browser. If you want to write php code locally you need some sort of webserver like Apache with php installed.

Share this post


Link to post
Share on other sites
On an additional note: installing Apache can be a pain in the butt. You'll very likely need to follow an online tutorial. Alternatively you can download something like xampp which will take care of everything for you...at which point you'll just need to drop your php file in the htdocs folder that xampp creates to run it on a local server.

Share this post


Link to post
Share on other sites
If you're on Windows, I'd strongly recommend the [url=http://www.microsoft.com/web/downloads/platform.aspx]Microsoft Web Platform Installer[/url] - it makes installing PHP a doddle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this