Jump to content

PHP noob question

- - - - -

  • Please log in to reply
7 replies to this topic

#1
delta9r9r

delta9r9r

    Newbie

  • Members
  • Pip
  • 4 posts
When I execute hello world.php in firefox:

<html>
<body>
<php
echo "Hello World";
>
</body>
</html>

I get no return.
The page that shows is blank. I have apache and PHP 5 installed. Help?

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
[B]Please use [noparse]
, [html], and [code][/noparse] where appropriate.

[/B]


Your code should be:

[php]<html>

<body>

<?php

echo "Hello World";

?>

</body>

</html>



#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
That does not generate valid PHP code of which can be ran, so likely if you view the source within Firefox, it will not parse that block and will be hidden in pink.

You may also be viewing the file directly (and not through http://localhost) and will also hide the code regardless if corrected.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
delta9r9r

delta9r9r

    Newbie

  • Members
  • Pip
  • 4 posts
Sorry, I checked and my code was:

<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>

as you stated. However, I'm new to the localhost thing. How does it work?

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You'll need something like XAMPP to process the PHP for you. Then you can navigate to h t t p: // localhost
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
delta9r9r

delta9r9r

    Newbie

  • Members
  • Pip
  • 4 posts
So i installed xamp and explored to the file. Echo still dosen't return anything?

#7
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Delta, Apache is a webserver as it sends your document to the client it can parse it through PHP.
Where did you install XAMPP to?? In the XAMPP folder there will be a htdocs folder, put your file in there. Change the name to hello_world.php and goto localhost/hello_world.php in firefox (open the XAMPP control panel and start Apache first!). :)
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#8
delta9r9r

delta9r9r

    Newbie

  • Members
  • Pip
  • 4 posts
Thanks so much for your help. Finally got it to work.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users