interview question and answer

August 8, 2012

Install movable type 4 on Windows Server 2008 with IIS7, PHP, Perl, CGI, MySQL

Install movable type 4 on Windows Server 2008 with IIS7, PHP, Perl, CGI, MySQL

For the purpose of this how-to, I will be using a AWS EC2 Instance.You will need console or Remote Desktop access to a Windows 2008 Server.






1.Login to your Server via Remote Desktop.



2.Remove IE Enhanced Security Garbage to make life easier when downloading/testing things

a.Start > Server Manager > Right side under Security Info “Configure IE ESC” > Turn Off for users + Administrators (screenshot)

3.Add Webserver Role (IIS) & .cgi Role Service

a.Server Manager > Roles > Add Role > Select WebServer (IIS) (screenshot)

b.Click Next, Next, Until you get to “Role Services”

c.Select both “CGI” and “ISAPI” Extensions under “Application Development” (screenshot)

d.Click Next, then “Install”

4.Download/Install ActivePerl (Latest version, x86 for 32bit OS)

a.http://www.activestate.com/activeperl/downloads/

b.Download the latest ” Windows Installer (MSI) “

c.Use Defaults for installation (Directory: C:\Perl)

5.Install movable type required PERL Packages

a.Start > All programs > Active Perl > Perl Package Manager

b.Press “CTRL+1″ to view all packages (or press the button in the interface)

c.Search for “DBI”, right Click “DBI” and mark for installation (may already be installed)

d.Search for “DBD-mysql”, mark it for installation

e.Press “CTRL+ENTER” to install the packages

6.Download Movable Type

a.http://www.movabletype.org/downloads/stable/ (I used MT-4.32-en.zip)

b.IMPORTANT: Do not download/use 4.33 IF you want monthly archives to work. There is a known Issue not yet documented by SixApart. Please see this post for more information: Monthly Archives not working in Movable Type 4.33

c.Save the file to your desktop

7.Extract Movable type & Move to web Directory

a.Go to your Desktop

b.Right click the MT-4.xx-xx.zip File, Choose Extract All

c.Use Default Destination Location (ex: C:\Users\Administrator\Desktop\MT-4.33-en)

d.Check the box for “Show extracted files when complete, click Finish

e.After extracting, the folder MT-4.xx-xx should pop up, open the MT-4.xx-xx folder

f.Hit “CTRL+A” to select all of the files and folders in the directory.

g.Hit CTRL+C to copy all of the files

h.Create a folder named “mt” inside of C:\inetpub\wwwroot\

i.Create a folder named “blog” inside of C:\inetpub\wwwroot\

j.Open your newly created “mt” folder and hit “CTRL+V” to paste all of the movable type files (screenshot)

k.Open the folder “mt-static” (C:\inetpub\wwwroot\mt\mt-static)

l.Hit CTRL+A to select all files

m.Hit CTRL+C to copy all files

n.Go into your blog folder (C:\inetpub\wwwroot\mt\blog)

o.Hit CTRL+V to paste all of the copied files

8.Configure IIS7 for Movable Type, and to use PERL for .cgi Extensions

a.Open IIS Manager

b.Expand your server, then sites, Click on Default Website, Then click “Basic Settings” on the right side (screenshot)

a.Change the physical path to C:\inetpub\wwwroot\blog

c.Right Click “default Web site” and select “Add Application…”

a.use alias: mt

b.and path: C:\inetpub\wwwroot\mt

d.Click on “default website”

e.Double click “Handler Mappings” (screenshot)

f.On the right side, click “Add Module Mapping…” and configure it like this screenshot, or as it is below:

a.Request path: *.cgi

b.Module: CGI Module

c.Executable: C:\Perl\bin\perl.exe “%s” %s

d.Name: CGIPerl

e.After Clicking “OK” you should be prompted “Do you want to allow this ISAPI Extension” Select “Yes”

9.Test: Open Internet Explorer, browse too: http://localhost/mt/mt-check.cgi

a.This page should show your current MT Configuration – and should look something like this (screenshot).

10.Download & Install PHP

a.Download the latest Windows binary ZIP File (not the installer) from: http://www.php.net/downloads.php

b.Extract the zip to C:\PHP

c.Copy C:\php\php.ini-dist to your desktop

d.Rename the copied php.ini-dist to php.ini

e.Right click php.ini and select Edit

f.Search (CTRL+F) for extension=php_mysql.dll and uncomment it by the deleting the ; in front of it. This allows php to login to your MySQL Database

g.Now move up in the php.ini code and look for extension_dir = “./”. Change“./” to “C:\php\ext”. This shows php where to load the extension=php_mysql.dll extension you just uncommented.

h.Save php.ini

i.Copy php.ini and paste it in C:\Windows

11.Configure IIS for PHP

a.Open IIS Manager (from start menu > search for IIS Manager)

b.Expand the root server > Sites > Click on “Default web site”

c.Double click handler-mappings

d.Click “Add Script Map” located on the right

e.Fill out the Add Script Map Window like so (screenshot):

a.Request Path: *.php

b.Executable: c:\php\php5isapi.dll

c.Name: PHP

d.NOTE: Some people say to use php5.exe instead of the DLL. My research showed that the .dll works best with IIS7

f.Copy the file “libmysql.dll” from C:\PHP, and paste it in C:\Windows\System32 (this is a known fix for a bug)

12.Test PHP Installation

a.Open Notepad

b.Type

c.Hit CTRL+S To save

d.Change the “Save as type” to “All Files *.*”

e.Filename: test.php

f.Browse for folders and save this to C:/inetpub/wwwroot

g.Open Internet explorer and browse to: http://localhost/test.php

h.You should see something like this (screenshot).





13.Install ImageMagick

a.Download the latest Q16-windows-dll “Binary Installer” from the ImageMagick Website.

example, I downloaded: ImageMagick-6.5.9-0-Q16-windows-dll.exe

b.During Installation Choose the Default Installation Path & Start Menu Folder

c.IMPORTANT: Make sure you check the box for “Install PerlMagick”. The version the installation wizard displays should also be the same Build as your installed Perl. (screenshot)

a.You can check this by opening a command prompt and typing “Perl -v”. The version displayed should match what is shown in the installation Dialog. (screenshot)

Important: Please reboot your server before continuing





14.Install & Configure MySQL

a.Download the latest MYSQL Community Server (x86, 32-bit, MSI Installer) from the dev.mysql.com website.

b.Save the Installer to the desktop and run it. Choose Typical Installation



c.Check the box to “Configure MySQL Now”

d.Click Finish, then next, then “Standard Configuration”

e.Use default setting to install MySQL as a system service

f.Create a root password

g.Click Execute to complete MySQL Installation

15.Configure a MySQL Database & User for Movable Type

a.Download MySQL GUI Tools from here

b.Install the tools using all default selections in the wizard

c.Launch MySQL Administrator & Connect to your MySQL Server Instance (screenshot)

a.host: localhost

b.username: root

c.password: (the password you set in step 14.6)

d.Once connected, Create a new Catalog (screenshot)

a.Click Catalogs

b.Right click below the default databses and select “create new Schema”

c.Name your schema: mt (screenshot)

e.Create a MT MySQL User

a.Click User Administration

b.Right click below the root user and choose “Create new User” (screenshot)

c.Name your user “mtuser” , create a password

d.Give your user permissions by clicking the “Schema Privileges” Tab, select the “mt” database, then Select all Available Privileges and click the “<” arrow to move them to “assigned”. (screenshot)

e.Hit “Apply Changes”

16.Configure Movable Type and Launch it! Finally!

a.Open C:\inetpub\wwwroot\mt

b.Copy mt-config.cgi-original

c.Right click mt-config.cgi-original > Rename it to mt-config.cgi

d.Modify the following lines in this file:

a.CGIPath http://localhost/mt

b.StaticWebPath http://localhost

c.Remove all selections that do not refer to the MySQL Database

d.Modify the MYSQL Section to use these values:

a.Database mt

b.DBUser mtuser

c.DBPassword (your MT user MySQL password)

d.DBHost localhost

e.The final product should look exactly like this Screenshot

17.Last step, visit your site, create your login, and start blogging!!!

a.Open: http://localhost/mt/mt.cgi

After Completing this tutorial, you have a working Installation of Movable type 4.xx on Windows Server 2008, With IIS7, PHP, Perl, MySQL, and all the bells and whistles.



If you want your blog to be accessible via the internet, you will need to purchase a domain, and set DNS to point to the Server you just setup. You would also need to modify mt-config.cgi to use http://www.yourdomain.com for the staticwebpath, and http://www.yourdomain.com/mt for the staticCGIPath. Lastly, you would need to setup host-headers in IIS7. If you need help I am just a comment away! Cheers –





No comments: