-2

So I'm just starting to learn php, and when trying " Hello World" the file isn't executing properly. I have Bitnami MAMP Stack 5.6.31 . I'm pretty sure it's not something wrong with the code, possibly with the install of the AMP stack, but this is the code anyway :

    <?php echo "Hello World"; ?> 
  • What's the name of the file? – Nate Whittaker Sep 08 '17 at 22:07
  • This is a pretty broad problem, as any number of things could be wrong, including: a misconfigured Apache server, misconfigured PHP, incorrect file permission/ownership, etc. Without knowing the steps you've taken and how you've configured things, it's impossible to diagnose the problem. – Major Productions Sep 08 '17 at 22:10
  • Check out this; [](https://stackoverflow.com/questions/3555681/why-are-my-php-files-showing-as-plain-text)https://stackoverflow.com/questions/3555681/why-are-my-php-files-showing-as-plain-text Might help :) – Jon Sep 08 '17 at 22:12
  • Are you double clicking on the file to open it or how are you trying to execute the file? – M. Eriksson Sep 08 '17 at 22:32

1 Answers1

0

You can't just "open" PHP files on XAMPP/MAMP/LAMPP/etc.

  1. Make sure your apache service is started in your MAMP console
  2. Make sure your file is saved in the document root of MAMP, which by default is 'MAMP/htdocs'
  3. If your file, say is stored like this: 'MAMP/htdocs/learningPHP/hello.php' then you would go to your web browser and type in localhost/learningPHP/hello.php

The script will then run.