Jump to content

Basic PHP question.


barakolshe

Recommended Posts

Hello, I have started learning php recently, but I feel like I don't understand the basics of it. 

here is a simple php file I ran in my broswer:


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

But instead of displaying Hello World!, the browser(chrome) presents this:

 

Hello

World!

"; ?>

 

and I don't know how to get rid of the last characters.

Edited by cyberRobot
removed the rogue [/size] tags
Link to comment
Share on other sites

As mentioned, you need to run your own webserver with PHP in order to process PHP files. That's not hard, just install Apache.

 

Then make sure your test file has a .php extension and you load it in your web browser as a URL, with http://. Such as http://localhost/test.php. "localhost" refers to your local computer, where you hopefully just installed Apache. If you just double-click on the file, it's not actually loading it via Apache.

 

The "test.php" has to be in a specific file location so Apache can read it correctly. I know it's /var/www/html/ on Ubuntu, but I forget where the folder is at on Windows.

Edited by Sepodati
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.