And this is what I have to go through in Windows when I’m not sitting on Linux.
Minus the Virtualhost, DNS, PHP & MySQL testing. It’s just to much work compared to Linux.
[ Apache 2.2 ]
1. Install Apache Server
http://httpd.apache.org/download.cgi
2. Stop Apache Server
Click on the icon next to the clock to get a menu.
3. Configuring Apache Virtualhost
http://apptools.com/phptools/virtualhost.php
C:\Program Files\Apache Group\Apache\conf\httpd.conf
Uncomment this line in httpd.conf:
Include conf/extra/httpd-vhosts.conf
4. Security
Add this block to the httpd-vhosts.conf file:
<Directory “C:/My Sites”>
Order Deny,Allow
Allow from all
</Directory>
5. Creating virtual hosts
Put these below the security block from previous step in the httpd-vhosts.conf file:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:/My Sites/Site1"
ServerName site1.local
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:/My Sites/Site2"
ServerName site2.local
</VirtualHost>
If your file path look like this then don’t use quotation marks ( " ).
DocumentRoot C:\\MySites\\Site1
6. Resolving the DNS issue
Edit either of these file paths:
C:\\WINNT\\system32\\drivers\\etc\\hosts
or
C:\\Windows\\system32\\drivers\\etc\\hosts
Just go to the bottom of the file, below all the comments and any existing
entries and add the following two lines:
127.0.0.1 site1.local
127.0.0.1 site2.local
7. Fixing default localhost after creating virtualhost
Okay, now I’ll mention one very small, but possibly important, caveat.
When you create the virtual hosts like this, the default http://localhost will no longer work.
In many cases, that is unimportant. However, if you’re using something like phpMyAdmin,
you’ll still need it. The solution to that is to create one additional virtual host called “localhost”
that points to the original Apache htdocs folder. It might look something like this:
<VirtualHost 127.0.0.1>
DocumentRoot C:\\Apache\\htdocs
ServerName localhost
</VirtualHost>
Don’t forget to include that additional virtual host when you edit the Windows hosts file.
[ MySQL ]
8. Remove old or bad MySQL installation
Improvise!
9. Install MySQL Server
Setup Type: Custom
10. MySQL Server Instance Configuration Wizard
Detailed Configuration
Developer Machine
Multifunctional Database
Select InnoDB Tablespace Settings: Keep default values.
Decision Support (DSS)/OLAP
Select Networking options:
Enable TCP/IP Networking
Port number 3306
Enable Strict Mode
Standard Character Set
Select Windows options:
Install as Windows Service
Service Name: MySQL
Launch the MySQL Server automatically
Include Bin Directory in Windows PATH
Then finish the install.
11. Testing the MySQL installation
START> Run> cmd
C:\\> mysqladmin -u root -p ping
C:\\> mysqladmin -u root -p version
C:\\> mysqladmin -u root -p status
C:\\> mysqlshow -u root -p
C:\\> mysql --help
C:\\> mysql -u root -p
mysql> help
mysql> status
mysql> quit
12. Install MySQL GUI Tools
sfsdf
[ PHP ]
13. Install PHP
http://www.php.net/downloads.php
Make sure you designate where Apache’s httpd.conf catalog is located during the installation.
14. Choose Items to Install
Select “Will be installed on local hard drive.” for these items.
PHP> Extras> PHP Manual
PHP> Extensions> MySQL
PHP> Extensions> MySQLi
PHP> Extensions> PDO> MySQL
Then finish the install.
15. Testing the PHP installation
http://localhost/phpinfo.php
<?php
phpinfo();
?>
16. Testing PHP call to MySQL database Server
http://localhost/dbtest.php
<html>
<head><title>Testing database connection</title></head>
<body>
<h1>Testing PHP call to MySQL database Server.</h1>
<?php
$dbLink = mysqli_connect("localhost","root","<PASSWORD>");
if ($dbLink) {
print mysqli_get_server_info($dbLink);
echo "<br /><br />" . "<h2>1 - It worked!</h2>" . "<br /><br /><hr />";
} else {
print mysqli_get_server_info($dbLink);
echo "<h2>1 - It doesn't work!</h2>" . "<br /><br /><hr />";
}
if (!$dbLink) {
print mysqli_get_server_info($dbLink);
echo "<h2>2 - It doesn't work!</h2>" . "<br /><br />";
} else {
echo mysqli_get_server_info($dbLink) . "<br /><br />";
echo "<h2>2 - It worked!</h2>" . "<br /><br />";
}
mysqli_close($dbLink);
?>
</body>
</html>