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.

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.