0

I would like to learn PHP and started reading this info's in the website: And I have question about this code:

Why is this line not displaying? " echo 'Neo: I am Neo, but my people call me The One.';"

Thanks

  <html>
  <head></head>
  <body>

  Agent: So who do you think you are, anyhow?
  <br />

  <?php
  // print output
  echo 'Neo: I am Neo, but my people call me The One.';
  ?>

  </body>
  </html>
6
  • please specify your OS? server activated (i mean running) ? Commented Sep 6, 2010 at 14:56
  • @Nagaraj:i'm using win 7 xampp Commented Sep 6, 2010 at 14:58
  • Do you see the php code when you view the source of the web page from your browser? Commented Sep 6, 2010 at 15:00
  • @erisco:what do u mean?i save this as html & then I run it in firefox.how can I do that? Commented Sep 6, 2010 at 15:02
  • When viewing the web page, hit ctrl+U or cmd+U on a Mac. Alternatively you may right-click somewhere on the web page and select View Page Source in the context menu. If you see the PHP code, it means PHP is not correctly configured with your server - or you made a mistake such as giving the file a .html extension instead of .php. Commented Sep 6, 2010 at 15:16

2 Answers 2

4

You need a webserver, and give it a .php extension. You cannot run it directly from your drive (e.g. /home/user/file.php or C:\file.php), you must run it from your server (e.g. http://localhost/file.php or http://example.com/file.php)

A webserver can be downloaded from http://www.xampp.org/

Sign up to request clarification or add additional context in comments.

3 Comments

as i'm a beginner forgive me for my question, can i use xampp as my server?
ok cool I have it already, i would like to know how to use it?
If you've installed XAMPP in C:\xampp, put your files in C:\xampp\htdocs. Example: C:\xampp\htdocs\file.php is accessible with http://localhost/file.php
1

Make sure you are using a virtual webserver such as mamp or xampp, Also try print instead of echo with "

2 Comments

i'm using xampp, what does it mean virtual webserver? i would like to know how to use this with my xampp, using windows 7
That's not a virtual webserver, but a webserver. Using print instead of echo won't solve the problem.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.