2

I'm new to this so please forgive me.

I have set up MAMP and am trying to run a PHP file (index.php). I have the green lights and have my index.php file inside the htdocs folder.

But nothing seems to show up in the browser.

Here is my setupenter image description here

I have done as told in the answers in this question running php on mamp

which includes:

http://localhost/index.php
http://localhost:8888/index.php

both give me a bank page.

I tried /Applications/MAMP/htdocs/index.php and it give me this.

enter image description here

0

1 Answer 1

6

Change this:

<php? echo"hello"; ?>

to:

<?php echo "hello"; ?>

The php's tags are:

<?php for opening and ?> for closing

Read the manual

Sign up to request clarification or add additional context in comments.

5 Comments

@MichaelSórm: There are ways to find these errors. You can enable error reporting in PHP, or just look in your Apache logs to find out what's wrong.
@MichaelSórm Everyone has the first time, don't worry :)
@elclanrs: error_reporting() is useful but I think in this case '<php? ' , it would not work...
I agree with @Aaron Gong. The reason it didn't work is that the PHP pre-processor did not recognize the block as PHP code and instead recognized it as plain text so it would have no reason to throw an error. If you throw this into the W3C HTML Validator using an XHTML strict doctype it still doesn't even cause so much as a warning. If you use a HTML 5 doctype it does throw an error though.
I agree too, error reporting in this case is not usefull, but is good that he mentioned for the future develop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.