We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

How to Test PHP Code Locally

Serving the "Hello World!" PHP script Using XAMPP

  1. Download the XAMPP installer from Apache Friends

  2. Install XAMPP at C:\xampp

  3. Create the new directory php-test under C:\xampp\htdocs

  4. Write a php script like the one shown below and store it as the file C:\xampp\htdocs\php-test\helloWorld.php

    <!DOCTYPE html>
    <html>
        <head>
            <title>Hello World!</title>
        </head>
        <body>
            <?php 
                print "<h2>Hello World!</h2>";   
            ?>
        </body>
    </html>
    


  5. Double click the XAMPP Control Panel and start Apache (see red circle below)

  6. image-20211217-091819.png
  7. If you are running another application on port 443 (such as for instance Skype), then you will get an error message (see red arrow pointing to red text above) and need to shut down that application and restart Apache

  8. Open the link http://localhost/php-test/helloWorld.php

image-20211217-091853.png



Last updated: