Saturday, December 17, 2005

Learning by doing

I use apache server on my computer to test my php mysql files before I upload them to my Internet server.

Till today I had to put all my projects in the same folder as I didn't know how the server would find them otherwise. Obviously, it is easier to keep each project in its own folder, and on the usb stick and not on the hard disk in case it dies on me.

A question on a Google group taught me how to do it.

Here is my summary:

1. I opened the file C:\WINDOWS\system32\drivers\etc\hosts in a text editor and changed the only instruction from

127.0.0.1 localhost
to
127.0.0.1 localhost calendar

2. I opened the file ...\xampp\apache\conf\httpd.conf in a text editor and added these instructions.

NameVirtualHost *:80

DocumentRoot "E:\programming\php programs\dx"
ServerName calendar

3. I copied all the files in my dx project to the folder
E:\programming\php programs\dx.

4. I restarted apache.

5. I typed this url in my web browser: http://calendar/dx_login.php.
Vuaw! The file was found and did its job as when it was in its original folder. In short: it worked!

No comments: