Recently I upgraded from Windows XP to Windows Vista Ultimate. I
had everything in XP. It was a hell of a development server. So after
installing Vista, I had to install everything again manually. This is really a
annoying and time consuming work. I wanned to reuse my previously installed
applications.
I used PHP/MySQL/Apache in my previous installation. As a
precaution, I always install 3rd party apps in a different drive other than
default “Program files” folder. So when I installed Vista, everything was left
in that drive. Then it was all about integrating the existing installation to
new OS.
Condition:
Here goes some condition which should be met in order to make
this thing work.
-
All mysql/php/apache/ websites should be as it was in xp.
better if itwas not in xp’s sytem drive
-
You need some files from xp’s systemroot. php.ini,
libeay32.dll, libmysql.dll, ssleay32.dll (right me if I am wrong). Just
copy those to another folder as a backup.
Process:
First of all you need to open an admin console. This is a
must. Go to Start menu > All Programs > Accessories > Command Prompt.
Then right click on it and choose “Run as Administrator”. The console
starts.
We can configure mysql, php and apache in any order. But I
recommend MySQL>PHP>Apache. Because Apache needs mod_php and php needs
php_mysql modules to be loaded. The only independent application is MySQL.
When MySQL is configured, PHP can call php_mysql extension. So then comes
configuring PHP. When PHP is done, Apache can call mod_php module as PHP is
up. So only thing is left configuring apache. Configure Apache and thats
it.
Configure MySQL:
-
In the admin console, go to previously mysql installation
directory.
-
Go to the bin directory. It should be there
-
Install mysql service
mysqld.exe –install <service name> –defaults-file=”location of
my.ini or my.cnf”
My command was,
mysqld.exe --install Mysql50 --defaults-file="E:\bin\mysql\mysql server 5.0\my.ini"
-
Start mysql service
net start <service name>
My command was,
net start mysql50
MySQL Should be up and running in this stage.
Configure PHP:
Remember we copied some dll files and php.ini from previous
windows root directory?? Yes, we are gonna need those files now. Copy all
those files to Vista’s %SYSTEMROOT% from the admin console.
copy \path\to\php.ini %SYSTEMROOT%\
copy \path\to\libmysql.dll %SYSTEMROOT%\
…
.. and so on.
Thats it. There is nothing more in this step.
Configure Apache:
-
In Admin console go to previous Apache installation
directory
-
Go to bin directory
-
Install httpd service. Enter the following command.
httpd -k install
-
Apache service was installed. But you need to know the
service name. Enter the following command.
net start | find /i "apache"
That’ll show you the service name
-
Now start Apache.
net start apache2.2
My service name was Apache2.2. It can be apache or apache2 for version 1
and 2 respectively
At this point all of your sites will starts working.
Configure Virtual Hosts (Optional):
If you use virtual hosts in apache like me, then you have do
something more.
-
Copy hosts files from your
PREVIOUS_XP_INSTALLATION_DIR\system32\drivers\etc\ location of previous
operating system (XP) to the current windows’
%SYSTEMROOT%\system32\drivers\etc\ location. You have to repalce the file.
It always better to create a backup of
%SYSTEMROOT%\system32\drivers\etc\hosts file.
-
Now locate 2 lines in the new hosts file containing
127.0.0.1 localhost
::1 localhost
If you find both of them you dont have to do anything. If you dont find
both or any of them just copy the missing one or both.
At this point your virtual hosts and all other sites with running
database will start working
Happy migration.
