Page 1 of 1
my first code how do i view php?
Posted: Sat Jun 18, 2011 2:07 pm
by Dannerz
I made my first .php document.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Your Title Here </title>
<meta name="Generator" content="Alleycode HTML Editor">
<meta name="Description" content="Your description here...">
<meta name="Keywords" content="Your keywords here...">
</head>
<body>
This is a test.
<?php
echo "Hello World";
?>
</body>
</html>
When I open the document with my browser,
it says "this is a test", but it does not say "Hello World".
I thought both were supposedto be visible.
What do i download so that I can view .php on my computer?
Re: my first code how do i view php?
Posted: Sat Jun 18, 2011 6:52 pm
by twinedev
To view it on your computer (ie. not actually uploading it to a web server elsewhere), you need to have a local web server to run it on. There are two options.
1. If you just have a windows machine, you can try xampp which does a decent job of installing Apache, mySQL, PHP and Perl to run as a local web server on your machine. (
http://www.apachefriends.org/en/xampp.html)
2. If you have a spare system, I'd suggest setting up a system as an actual server running linux. (search for tutials on google, plenty of them)
-Greg
Re: my first code how do i view php?
Posted: Sat Jun 18, 2011 8:13 pm
by Dannerz
Thank you for your helpful reply.
I will see what I can download, and if i can't get it to run on my computer,
ill try to find a free server to upload and test files on.
Re: my first code how do i view php?
Posted: Sat Jun 18, 2011 10:27 pm
by califdon
Just to expand on the reasoning behind this, PHP is a server language, the browser never sees it (hopefully!), so if you merely open a local PHP document in your browser, it's unable to parse the PHP. You have to request the document from a web server (Apache or IIS), which parses the PHP language, does whatever that tells it to do, THEN sends the results to the browser. This is a vital concept to have when you begin working with PHP.
Re: my first code how do i view php?
Posted: Sun Jun 19, 2011 10:44 am
by social_experiment
Dannerz wrote:What do i download so that I can view .php on my computer?
If you are running a windows operation system look for XAMPP (as twinedev mentiones), it's easy to install and to use once it has been installed.
Re: my first code how do i view php?
Posted: Sun Jun 19, 2011 12:27 pm
by ScOrPi
use php designer , it has localhost without installing Apache or camel server