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
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
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.
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:
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!
When corrected by yourself ( to put the ?) I had added a space by accident between <? and php, causing it not to work.