Het werkt inderdaad op de Apache2 server.
Dank voor de raad.
Ik voer http://localhost in, gevolgd door de naam van het php bestand, zoals http://localhost/test.php. Voorwaarde is wel dat dit php bestand in /var/www zit.
Moet ik al mijn php files naar die map verplaatsen (eventueel sub dirs aanmaken) of is er een andere syntax mogelijk? Ik heb geprobeerd: http://localhost/home/luc/[pad naar mijn bestanden] maar Mozilla zegt dat het bestand niet gevonden kan worden.
Luc
Als je met subdirs werkt in /var/www, kun je de boel overzichtelijk houden.
Anders kijk je even naar dit:
Adding a virtual host to your LAMP server
This allows us to access a different folder as our webroot from a different address in our browser - face it, 'localhost' or 127.0.0.1 is boring.
Start by adding a new host. This is easy to do via System --> Administration --> Network; click on the Hosts tab, select the localhost item from the list and click properties. You may need to click the 'Unlock' button and enter your password first. Underneath the entry 'localhost', on a new line, add your entry of choice; for example, we'll use 'testhost'. Add this, and close all the dialogs.
To confirm that the above worked, you can check the '/etc/hosts' file.
sudo gedit /etc/hosts
You should see the following line.
127.0.1.1 testhost
Now we need to edit the Apache configuration file, so type into the console:
sudo gedit /etc/apache2/httpd.conf
In the resulting file (which may well be empty), add the definition for your host! My username is 'dan', and I want my webpages to be served from a directory named 'www' in my home, so I would add:
ServerName testhost
DocumentRoot /home/dan/www
where testhost is the name of the new virtual site (it must match the above entry in your conf file).
After this, you need to restart apache so it can load these new configuration file entries.
sudo /etc/init.d/apache2 restart
I can now add files to /home/dan/www, and access them by visiting
http://testhostIk heb dit van
deze site