Installing Apache + MySQL + PHP on Windows 7 64Bit
The process is pretty straight-forward, except for a few bumps along the way. The majority of problems were caused by the Access Control functionality of Win 7. Make sure your text editor is running with admin rights. Without which you’ll not be able to save any edits to the config files.
The first issue was during Apache (2.2.14-x86) install; kept getting the following error:
Errors reported here must be corrected before the service can be started. httpd.exe: Could not reliably determine the server's fully qualified domain name , using 192.168.1.3 for ServerName (OS 10048) Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Note the errors or messages above, and press the key to exit. 24...
After 10mins of trying to figure out the problem with no success, did a search and found that this was due to port 80 being used by another program – typically Skype! Which made sense as I had Skype running. Once I quit Skype and restarted Apache, everything started up smoothly.
Next, I wanted to get my virtual hosts setup. I like to keep my virtuals in their own separate file – 1 file per host. This is pretty easy to setup – just direct Apache to load up additional conf files with an “Include” directive.
NOTE: There’s a sample virtual host config file included with the Apache install in “conf/extra” folder, which may be modified to your needs.
Open the default httpd.conf and add the following to the end of it.
# Setup virtual hosts # Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost DocumentRoot "D:/webapps/_root"
<Directory /> Order Allow,Deny Allow from all </Directory>
</VirtualHost>
Include "D:/webapps/_virtuals/*.conf"
Next, create blog.conf file with the following content. Make sure to give it a meaningful name – something like blog.sprit3.conf, so that it can be located easily. Save the file in the _virtuals folder.
<VirtualHost *:80>
ServerName blog.sprit3.net DocumentRoot "D:/webapps/www/blog.sprit3"
<Directory /> Order Allow,Deny Allow from all </Directory>
</VirtualHost>
By default Apache will deny any requests to the virtual folders unless allowed explicitly. Hence the <Directory> tag.
Save this in the _virtuals folder and restart Apache. Verify if virtuals are running properly by entering “httpd -S” via the command prompt.
Next step is to add the virtual host address to the local host file so that any requests to blog.sprit3.net will be directed to my localhost instead of the live site. Windows hosts file is located at %SystemRoot%/system32/drivers/etc folder.
That should get the virtual folder running and all the web apps nicely organised!
