63

I am starting to pick up PHP / MySQL, but in all the documentation I'm reading, it mentions /var/www/html as being the folder you want to install a framework such as CakePHP, or for example /var/www/html being the folder you want to install your website on, so that everything is in root.

What exactly does /var/www/html mean?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Jason Sherman
  • 645
  • 1
  • 5
  • 6
  • 3
    This is the default path that the more popular web servers use as the default. You should use the folder path your host says to use. – Joe Apr 24 '13 at 16:47
  • It's the base directory for your website. You might have a www folder or a html folder, it all depends on the host and OS. – Alexis Tyler Apr 24 '13 at 16:47
  • 1
    If you review your Apache configuration you will find all the details there about what it has by default configured the document root to be. You can update it there to any folder of your choice – Hanky Panky Apr 24 '13 at 16:48
  • 1
    `/var/www/html` is the linux directory on your computer in windows it could be `c:\www\ `. Apache can be setup to look at this directory and process those files ie `c:\www\index.php` can be server as `http://localhost/index.php` – Waygood Apr 24 '13 at 16:49

2 Answers2

46

/var/www/html is just the default root folder of the web server. You can change that to be whatever folder you want by editing your apache.conf file (usually located in /etc/apache/conf) and changing the DocumentRoot attribute (see http://httpd.apache.org/docs/current/mod/core.html#documentroot for info on that)

Many hosts don't let you change these things yourself, so your mileage may vary. Some let you change them, but only with the built in admin tools (cPanel, for example) instead of via a command line or editing the raw config files.

Stephen Fischer
  • 2,445
  • 2
  • 23
  • 38
34

In the most shared hosts you can't set it.

On a VPS or dedicated server, you can set it, but everything has its price.

On shared hosts, in general you receive a Linux account, something such as /home/(your username)/, and the equivalent of /var/www/html turns to /home/(your username)/public_html/ (or something similar, such as /home/(your username)/www)

If you're accessing your account via FTP, you automatically has accessing the your */home/(your username)/ folder, just find the www or public_html and put your site in it.

If you're using absolute path in the code, bad news, you need to refactor it to use relative paths in the code, at least in a shared host.

Community
  • 1
  • 1
Fernando Jorge Mota
  • 1,506
  • 1
  • 10
  • 13