I assumed that your followed my previous post for your webhost (http://ccstone.blogspot.com/2008/09/how-to-build-web-host-on-your-computer.html) and it is now the time make it accessible from outside world.
1) Change Default Port of your WebHost
1a) Open \mowes\apache2\conf\httpd.conf
1b) Goto line 127 (or somewhere around there
1c) Search for "Listen 80"
1d) Change 80 into any number between 2000 to 8000 (as you like), e.g. 2337
1e) Save and exit
1f) Restart mowes
1g) Give your homepage a test: originally you access a page like http://localhost/mingpao.php , now you have to access the same page with http://localhost:2337/mingpao.php
Notes: the reason behind changing default port is that most ISP blocked port 80, and it is not an easy (noob) task to redirect traffic
2) Setup Port forward in your router (if you have one)
There is no detailed instruction for this setting, as everyone use different brand and model of router. But in general you can follow procedure
2a) Open Command Prompt ("Run..." then enter "cmd")
2b) Type ipconfig and press enter. This is an example of result:
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.222
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
2c) Start browser and browse the page indicated by "Default Gateway". E.g. http://192.168.1.1/ . You are now in router setting.
2d) Enter password as needed. Those login information can be retrieved from your router manual.
2e) Look for Firewall setting / Port Forward / DMZ / etc.. Every brand and model differ from each other, so you have to navigate yourself to the destination.
2f) Setup a Port Forward to your computer. E.g. map port "2337" to "192.168.1.222" as IP Address in your ipconfig result.
2g) Save setting and retrieve your EXTERNAL IP address from your router setting. It can usually be found in "Connection Status" page or "Internet Setting" page. E.g. "202.169.200.234"
2h) Test if your setting is correct. Instead of using http://localhost:2337/mingpao.php, now try http://202.169.200.234:2337/mingpao.php
3) Setup a free domain name for your webserver
Some new router include this function internally. If so, follow the instruction in router manual. For those routers without such setting, or if you do not use a router at all, follow this instruction for easy domain setup.
3a) Visit http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html
3b) Sign up the FREE DNS redirect service
3c) Register a Domain of your choice. E.g. helloworld.myvnc.com
3d) Download and install the No-IP DUC client.
3e) Add in the Hosts your newly registered domain
3f) Test your new host. Instead of http://202.169.200.234:2337/mingpao.php, try http://helloworld.myvnc.com:2337/mingpao.php
3g) (Optional) Setup the "Port 80 redirect" function at NO-IP DUC, so that you don't have to enter the port 2337 (I didn't do it personally)
-------------
After all those setup, you can now access your webhost from anywhere in the world, including your Laptop, iPhone, PDA, etc.
Enjoy
Friday, February 20, 2009
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.
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.
Sunday, June 1, 2008
Friday, May 23, 2008
BlackBerry Bold 9000 Hands on
As some of you may know, I work for a company that concentrate on developing Input Method for various platform. I am the one responsible for development on Blackberry and today I received the newest product from RIM, the Bold 9000.
If you have ever played with any of the 8xxx series and now holding a brandnew 9000, you may be impressed by its new interface, new functionality and new plastic/metal case.
However, to make things short, I conclude with one sentence: It looks well, it plays badly.
If you are looking for tech details for Bold, read CNET news, or if you want some screenshot, visit crackberry. The one on my hands looks exactly the same. And it's awesome. (Don't compare it with iPhone though)
As a Chinese Input Method developer, what I concern most, as any Chinese would do, is the ability to display and enter Chinese characters. When comparing with the Font on Pearl, which looks like Chinese Char in CWin31 or just eTen, the ones on Bold are clean and clear, and are as good as those on newest Windows Mobile. Bold support HKSCS natively, so there should be no problem reading Hong Kong News. Moreover, Bold has built-in support for multi-lingual User Interface. One can choose its favorite Interface language right from SetupWizard.
The true power of BB handheld relied on its ability on messaging. Actually I didn't see many Hong Kong Blackberry users typing in Chinese (I see users on MTR mostly). Maybe it's because its poor support on Chinese Char Typing. (Visit here for details on Chinese Support).
Bold supports quite a number of Chinese Input Method (natively, like UI) , like 粵拼, 注音 and 倉頡. However, after the "first taste" of using the input method, I lost my chance to test further... THE INPUT METHOD BROKE MY BLACKBERRY!!!
I started up my Blackberry in English Interface with 粵拼 input method. I went to "message" and compose my first email. Everything is the same as in 8xxx machines, nothing surprising. As I have no real experience using 粵拼, I tried some common strokes like "lee" "sin" "sang" and something like that. The control is really bad as if it is programmed by a guy without any experience on Chinese typing. I tried to type a little faster, but it seems to be extremely slow (on searching output?). The speed is unacceptable and I started losing temper. I tried to hit the keyboard in random and finally it showed me "Input Method Error, restarting..." (not exact phrase). That message popup since then whenever I typed fast enough, which is like 3 key per second (not 3 char per second), which is common for any "normal" Chinese typer. I lost my interest and go on testing something else, like Web Browser.
About half an hour later I switch the machine into Chinese Trad Interface, hoping a native Chinese Interface would gain better performance working in Chinese. I start the message editor again and try typing like before. I sense strangely as i switched between input method. The BB gave me 注音 chars when the active input method is 倉頡, wtf. I keep typing until the proper 倉頡 show up, then after like 2 sec... my BB hanged up. There were no response whatever I do, including pressing and holding the POWER button. It showed me the BB is shutting down and is actually hanged.
There's nothing I can do, and I remove the battery and put it back again (a normal hard reset for BB). I think it will be fine since I do reset like 50-60 times a day when i worked on it (install/uninstall require restarts). But no luck, it gave me "SYSTEM PROCESS ERROR" and force me to reset. And of course, no luck after reset. And i am now holding a bricked Blackberry Bold.
To be lucky is that the machine is a sample from the network provider and I can wait for an exchange a few day later. I should not have great hop as it's just a demo machine anyway. I hope that the stability can be improved before its release. The release date is not announced, and they should have lots of things to do. (and Thx to those sloppy programmers, my state in my company is as firm as it can be)
If you have ever played with any of the 8xxx series and now holding a brandnew 9000, you may be impressed by its new interface, new functionality and new plastic/metal case.
However, to make things short, I conclude with one sentence: It looks well, it plays badly.
If you are looking for tech details for Bold, read CNET news, or if you want some screenshot, visit crackberry. The one on my hands looks exactly the same. And it's awesome. (Don't compare it with iPhone though)
As a Chinese Input Method developer, what I concern most, as any Chinese would do, is the ability to display and enter Chinese characters. When comparing with the Font on Pearl, which looks like Chinese Char in CWin31 or just eTen, the ones on Bold are clean and clear, and are as good as those on newest Windows Mobile. Bold support HKSCS natively, so there should be no problem reading Hong Kong News. Moreover, Bold has built-in support for multi-lingual User Interface. One can choose its favorite Interface language right from SetupWizard.
The true power of BB handheld relied on its ability on messaging. Actually I didn't see many Hong Kong Blackberry users typing in Chinese (I see users on MTR mostly). Maybe it's because its poor support on Chinese Char Typing. (Visit here for details on Chinese Support).
Bold supports quite a number of Chinese Input Method (natively, like UI) , like 粵拼, 注音 and 倉頡. However, after the "first taste" of using the input method, I lost my chance to test further... THE INPUT METHOD BROKE MY BLACKBERRY!!!
I started up my Blackberry in English Interface with 粵拼 input method. I went to "message" and compose my first email. Everything is the same as in 8xxx machines, nothing surprising. As I have no real experience using 粵拼, I tried some common strokes like "lee" "sin" "sang" and something like that. The control is really bad as if it is programmed by a guy without any experience on Chinese typing. I tried to type a little faster, but it seems to be extremely slow (on searching output?). The speed is unacceptable and I started losing temper. I tried to hit the keyboard in random and finally it showed me "Input Method Error, restarting..." (not exact phrase). That message popup since then whenever I typed fast enough, which is like 3 key per second (not 3 char per second), which is common for any "normal" Chinese typer. I lost my interest and go on testing something else, like Web Browser.
About half an hour later I switch the machine into Chinese Trad Interface, hoping a native Chinese Interface would gain better performance working in Chinese. I start the message editor again and try typing like before. I sense strangely as i switched between input method. The BB gave me 注音 chars when the active input method is 倉頡, wtf. I keep typing until the proper 倉頡 show up, then after like 2 sec... my BB hanged up. There were no response whatever I do, including pressing and holding the POWER button. It showed me the BB is shutting down and is actually hanged.
There's nothing I can do, and I remove the battery and put it back again (a normal hard reset for BB). I think it will be fine since I do reset like 50-60 times a day when i worked on it (install/uninstall require restarts). But no luck, it gave me "SYSTEM PROCESS ERROR" and force me to reset. And of course, no luck after reset. And i am now holding a bricked Blackberry Bold.
To be lucky is that the machine is a sample from the network provider and I can wait for an exchange a few day later. I should not have great hop as it's just a demo machine anyway. I hope that the stability can be improved before its release. The release date is not announced, and they should have lots of things to do. (and Thx to those sloppy programmers, my state in my company is as firm as it can be)
Sunday, May 4, 2008
Charles Wilson's War
昨天看完DVD版的Charles Wilson's War,很失望。
失望的不是Tom Hans的表現、不是Julia Roberts的表現、不是故事、不是整個制作的任何一個部份。反之,在這幾個方面我也很喜歡,很欣賞。
使我失望的唯一一個地方,是香港方面的宣傳。
Charles Wilson's War是人物傳記,講述的是一名美國的Congressman,利用他的影響力,以協助阿富汗於八十年代被蘇聯入侵時作出反擊,說白一點,是反戰電影。
此片是2007的制作,香港於2008年3月左右上映。當初第一次接觸到此片,是在RoadShow上看到的宣傳片,中文名好像叫做「韋氏風雲」。宣傳片上最令我留意的,當然是Tom Hans。(自Forrest Gump開始,只要是Tom Hans我也會很留意)也就是說,我看此片的主因,就是看角色,怎樣看此片也是「大卡士」之作吧。
因那是RoadShow的宣傳片,聲音差點聽不到,所以只能用眼去判斷那是什麼的片。宣傳片的內容除了各人的對手戲外,最特出的就是Julia Roberts從水裡走出來的一段,占時間肯定是最長的。看了不只一次,就是看不出這是什麼主題的作品,沒有所謂,反正都會看。
看罷,不能說是非常出色,但也找不到大問題(除了歷史的部份,有關蘇聯撤兵原因的一段過份簡單)。可能因為此片太「美國」,有些背景未能理解,這是自身認識不足的問題,說不上是什麼缺點。
但這港版的宣傳片,也實在是太爛了。其實片中有很多出色的鏡頭,例如在巴基斯坦難民的一段,又或者是Soviet Copters等,都值得加入宣傳片中。至少,從宣傳片中我看不出阿富汗,甚至看不出戰爭。
想深一層,宣傳片的爛,責任何在?是不是發行商的錯?我想也未必。
爛的不是宣傳,而是香港觀眾。如果打正旗號是反戰片,有多少港人會去看?關心國際事務的人不斷減少,炒股的人數則不斷提升,「關心國際大事」就即是「關心會影響股價的事」的意思。縱使Julia Roberts的角色有如「夏蕙姨」,不打緊,找一段載黑超的就無問題。沒有「美色」的西片,怎樣騙你們入去看?
失望的不是Tom Hans的表現、不是Julia Roberts的表現、不是故事、不是整個制作的任何一個部份。反之,在這幾個方面我也很喜歡,很欣賞。
使我失望的唯一一個地方,是香港方面的宣傳。
Charles Wilson's War是人物傳記,講述的是一名美國的Congressman,利用他的影響力,以協助阿富汗於八十年代被蘇聯入侵時作出反擊,說白一點,是反戰電影。
此片是2007的制作,香港於2008年3月左右上映。當初第一次接觸到此片,是在RoadShow上看到的宣傳片,中文名好像叫做「韋氏風雲」。宣傳片上最令我留意的,當然是Tom Hans。(自Forrest Gump開始,只要是Tom Hans我也會很留意)也就是說,我看此片的主因,就是看角色,怎樣看此片也是「大卡士」之作吧。
因那是RoadShow的宣傳片,聲音差點聽不到,所以只能用眼去判斷那是什麼的片。宣傳片的內容除了各人的對手戲外,最特出的就是Julia Roberts從水裡走出來的一段,占時間肯定是最長的。看了不只一次,就是看不出這是什麼主題的作品,沒有所謂,反正都會看。
看罷,不能說是非常出色,但也找不到大問題(除了歷史的部份,有關蘇聯撤兵原因的一段過份簡單)。可能因為此片太「美國」,有些背景未能理解,這是自身認識不足的問題,說不上是什麼缺點。
但這港版的宣傳片,也實在是太爛了。其實片中有很多出色的鏡頭,例如在巴基斯坦難民的一段,又或者是Soviet Copters等,都值得加入宣傳片中。至少,從宣傳片中我看不出阿富汗,甚至看不出戰爭。
想深一層,宣傳片的爛,責任何在?是不是發行商的錯?我想也未必。
爛的不是宣傳,而是香港觀眾。如果打正旗號是反戰片,有多少港人會去看?關心國際事務的人不斷減少,炒股的人數則不斷提升,「關心國際大事」就即是「關心會影響股價的事」的意思。縱使Julia Roberts的角色有如「夏蕙姨」,不打緊,找一段載黑超的就無問題。沒有「美色」的西片,怎樣騙你們入去看?
Tuesday, April 29, 2008
php_curl + cookies
curl_setopt($ch, CURLOPT_COOKIEJAR, "d:\Web\PHP\cookieFileName");
很多script會使用cookies,但cookies path最好是full path
很多script會使用cookies,但cookies path最好是full path
Monday, April 28, 2008
PHP5 + Apache2.2 + cURL + windows XP
我用的是PHP Win32 installer,已選好php_curl的設定,但當行script時發現
Fatal error: Call to undefined function: curl_init() in xxxx.php
於是到phpinfo看,curl module沒有load
再看apache的error log
Unable to load dynamic library 'd:\\PHP\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
file明明存在,但就是load不到,所有file都在其位,path variable, php.ini,httd-conf都ok,但就是不行
最後將ssleay32.dll及libeay32.dll放到system32... 就行了
原因不明,path 明明是正確的... 算了,能行就好
Fatal error: Call to undefined function: curl_init() in xxxx.php
於是到phpinfo看,curl module沒有load
再看apache的error log
Unable to load dynamic library 'd:\\PHP\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
file明明存在,但就是load不到,所有file都在其位,path variable, php.ini,httd-conf都ok,但就是不行
最後將ssleay32.dll及libeay32.dll放到system32... 就行了
原因不明,path 明明是正確的... 算了,能行就好
Subscribe to:
Posts (Atom)