Very Basic - Jump Start PHP book - Server Folder

Sorry if this seems very basic to people, but I have never run a MAMP local server on my computer and I have come across a section of the book where I need to save a file called “info.php” with the following code in:

<?php
phpinfo ();

It tells me to save it in my “server folder” but I don’t have a clue where this is? As I said I do apologise if this is really stupid, anyones helps would be greatly appreciated

Many Thanks

If you go to your MAMP folder you should see other folders inside it.
I don’t know what it’s named in MAMP but it should be something like
public html
htdocs
www

Do you see anything like any of those?

I see htdocs?

That’s the one you want. That’s the folder your browser will go to when you start your local host server and go to
http://127.0.0.1/ or http://localhost/

If you put the info.php file in it and use your browser to go to
http://localhost/info.php
you should see a whole lot of interesting and good to know information.

Thanks for that, I have saved a php document in Applications>MAMP>htdocs>my_project ( a folder I created)

so then i put into my browser http://localhost/my_project/index.php

As it says in my book but I have a blank white screen, when I view the source though I can can se the php code of:

<php echo “Hello World”; ?>

Which is exactly what I have put in the file.

Thanks for the swift responses

Did you forget the “?” for the opening PHP tag? i.e. <?php
AFAIK you don’t need to put the “index.php” at the end, the server is most likely set to go to an “index” page automatiically by default.

I have just tried this but I am still getting a blank screen:

and this is the code:

Do apologise for the multiple edits in this post, but there were two problems:

  1. The code in the book was:
    " <php echo “Hello World”; ?>

There is obviously a typo in the book, which in my opinion is bad form, especially as it is a beginners book, and I wouldn’t know the difference. To have a typo in the most critical beginning section is very bad!

  1. When corrected by yourself ( to put the ?) I had added a space by accident between <? and php, causing it not to work.

Thanks for your help I can move on now!

Ugh, I agree and I’ll get that sorted asap. Apologies for the confusion that it caused.