Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I find DocumentRoot on Ubuntu after installing PHP, MySQL and Apache2?

I am new to Ubuntu Linux (version 13.10). I am following this tutorial to install MySQL, PHP, and Apache2.

It installed successfully, but I don't know where to write PHP files that execute when you navigate to the URL localhost/example.php.

I am looking at this link, but I am afraid that maybe it will not work and have to reinstall Ubuntu again.

like image 326
Hesbe Reygan Avatar asked Dec 17 '25 09:12

Hesbe Reygan


2 Answers

In a newer version should be in a different path: /var/www/html

With a series of commands you can find:

 ls /etc/apache2/sites-available/

That answers with something like

 000-default.conf  default-ssl.conf

In this case you need the second file default-ssl.conf; with

 grep -n -e "DocumentRoot"  /etc/apache2/sites-available/default-ssl.conf

you can obtain:

 5:              DocumentRoot /var/www/html

That means you can find (and change) DocumentRoot definition in the 5-th lines of the file /etc/apache2/sites-available/default-ssl.conf.

like image 100
Hastur Avatar answered Dec 20 '25 01:12

Hastur


As a simple Google search would have showed you, it's (by default), /var/www/.
In the Ubuntu default config, that is defined in the default virtual host, the config file for that is /etc/apache2/sites-available/default

like image 29
Johannes H. Avatar answered Dec 20 '25 02:12

Johannes H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!