Sunday, September 14, 2008

How to build a Web Host on your computer

Here is the procedure for setting up a web host at home and have PHP/MySQL ready with php_curl library support.

Step 1) Download MoWeS

Goto http://www.chsoftware.net/en/useware/mowes/mowes.htm
Choose "Download" from the left menu.
Click "No thanks, take me to the download"
Click "I Do not have a MoWeS Protable II... "
When choosing the component, check
Apache2
MySQL5
PHP5
PHPMyAdmin
and press "Download now".

Notes: I do not know why people keep asking if they should download the SE version of the modules. Just follow exactly the component named above.

Step 2) Extract & start up
Extract the content to C:\mowes. At this moment you should have mowes.exe as C:\mowes\mowes.exe
Run mowes.exe, it prompt you for setup those components you have chosen.
Start the installation and press "OK" several times.
The webhost will start automatically and your browser will start and goto the hosted website.

Step 3) Get ready with CURL library
In the MoWes Portable II windows, press options.
ON: Start Apache and MySQL automatically when MoWeS starts
ON: Hide the Apache window
OFF: Delete xx logfiles after stooping
OFF: Start Webbrowser
OFF: Start External App
other setting left as default.
Press Accept and OK
Press "End" in your Mowes window. The webhost will be down.

Goto C:\mowes\php5, copy the 2 files:
libeay32.dll
ssleay32.dll
to your windows system32 folder ( usually c:\windows\system32).

Open C:\mowes\php5\php.ini in text editor. Modify the following lines:
205:
implicit_flush = On
321:
max_execution_time = 120
674:
extension=php_curl.dll
696:
extension=php_openssl.dll
727:
date.timezone = Asia/Hong_Kong
Save and exit text editor.

Notes: Some of the changes include removal of a ';' (semi-colon). Be really really careful and the line should be completely like the one written above. No exception for any of the above lines, each line contain changes to be made.

Notes 2: for line 727, it specifies the default time zone so that any time displayed will be under that time zone. If you are not from Hong Kong, take a look at HERE for more cities of your choice.

Step 4) Testing
Start mowes.exe. The webhost will be ready.
Put any file C:\mowes\www , for example a.zip
Open your web browser, URL = http://localhost/a.zip
If successful, you will be prompted to download a.zip
Put mingpao.php to C:\mowes\www
If successful, you will be reading today's mingpao

Notes: mingpao.php is the ultimate testing script for your configuration. It can be obtained here.