Ubuntu Apache Path Question

I successfully installed LAMP (see another blog post here for details).

I KNOW that I can place files in /var/www such as .html and .php and .css and those files will be found and executed whenever I launch the browser and type localhost/report.html (i.e. if report.html is in /var/www it will run, and if it calles report.php and that file is in /var/www it will execute.


Suppost I want to have different folders holding different applications. What do I need to do to guarantee that Apache and PhP and MySQL will execute properly when invoked by files in a different folder.

I did find THIS in google:

There’s a ‘doc_root = ‘ in php.ini.
There’s also ‘DocumentRoot “drive:/path/”‘, ‘

and ‘DirectoryIndex index.html index.php otherfile.ext’ in the

Does that mean that I should simply edit php.ini and put a search path?

SOMEONE IN KUBUNTU IRC CHANNEL told me I should google. Then they said they do not know too much but it is probably in php.ini which is a well documented file, so I took a second look and found:

; About php.ini ;
; This file controls many aspects of PHP’s behavior. In order for PHP to
; read it, it must be named ‘php.ini’. PHP looks for it in the current
; working directory, in the path designated by the environment variable
; PHPRC, and in the path that was defined in compile time (in that order).
; Under Windows, the compile-time path is the Windows directory. The
; path in which the php.ini file is looked for can be overridden using
; the -c argument in command line mode.

THIS LEADS ME TO BELIEVE THAT IF IN TERMINAL I issue cd /Desktop/testwww that perhaps that becomes the “current directory” and hence, in the browser, issuing the localhost/report.html would now look in that current directory. I will test out this theory.

I AM MAKING SLIGHT PROGRESS, because I created on Desktop testwww and I discover that the following link in the browser will open a copy of my file


so now all I need to do is copy the php there and see if it executes ok.

So far, it does not seem to work!?

[22:59] WilliamBuell: Aye; you want to go to /etc/apache2/sites-enabled/
[22:59] MenZa: that does sound familiar
[22:59] WilliamBuell: Create a config file, i.e. blah.domain.conf
[23:00] WilliamBuell: I’ll give you one of my config entries so you have something to work with

<VirtualHost *:80>
DocumentRoot "/var/www/projects.lassehavelund"
ServerName projects.lassehavelund.com
<Directory "/var/www/projects.lassehavelund">
allow from all
Options +Indexes

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: