Reputation: 73
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.
Upvotes: 3
Views: 19299
Reputation: 41
In vscode (I'm sure in other editors as well) you can right click the file and copy path and copy relative path.
http://127.0.0.1:8000/site.php
Works for me.
Upvotes: 0
Reputation: 2828
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
.
Upvotes: 16
Reputation: 33056
The default location of document root is /var/www
. This, assuming you haven't touched the HTTPd configuration.
By the way, if you simply need a development server for PHP scripts, you can use the one emebedded in PHP > 5.4. Just cd
to the project directory and launch:
php -S localhost:8008
Upvotes: 2
Reputation: 6167
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
Upvotes: 3