0

I want to test some PHP code, but when I write the following code:

<!DOCTYPE html>
<html>
    <body>
        Sun
        <?php
            echo "My first PHP script!";
        ?> 
        Flower
    </body>
</html>

it only displays "Sun" and "Flower". I have XAMPP installed; XAMPP Apache and MySQL are running. Also, the extension is".php". So, do you know how to solve this problem?

Thank you!

(I am new in learning PHP)

  • How do you call your script in your browser and where is it located ? – Rizier123 May 15 '15 at 15:02
  • I am so sorry, but I don't understand what are you asking me... I tooked this code from a web site from where you can learn PHP, so I pasted into my text editor to see how it's working.. –  May 15 '15 at 15:10
  • How does your url looks like: `http://localhost/yourPHPFileWhichIsHopfullyLocatedInTheServerDirectory.php` or `file:///C:\xampp\htdocs\IdontKnow.php` ? – Rizier123 May 15 '15 at 15:11
  • It looks like file:///C:\xampp\htdocs\IdontKnow.php –  May 15 '15 at 15:14
  • 100pt. for me :) ^^ See the link to the dupe above, there is everything nicely explained; (If you still get stuck write a comment) – Rizier123 May 15 '15 at 15:16
  • I put 127.0.0.1/FolderName/webPageName.php and it works, but I don't know why.. –  May 15 '15 at 15:27

0 Answers0