Where do I put my Hello world PHP file on Ubuntu?

The document root folder under *buntu 14.04 is /var/www/html/

The link for your browser is then: localhost/FILENAME.php


The most voted solution didn't work for me. What I did to solve it was: searching directly in the root for the faq.html file that comes with XAMPP, and found that it was located in

/opt/lampp/htdocs

so there is where I put my files, and it worked perfectly. Cheers.


Pick a name for it lets use hello.php for this example.

On Ubuntu the folder is /var/www/html, NOT /var/www. You will need root access for that. So you save the file as /var/www/html/hello.php.

Open up a web browser and enter the following address:

localhost/hello.php

And BAM. There's you page.

Tags:

Php

Apache