Put your message here! Contact me for more information
 
 







 

Archive for the ‘Server’ Category


 

After reading my buddy’s blog (http://blog.tvlgiao.com/) about the PHPEclipse, I decided to give it a shot. I’ve been using the Zend IDE because I love the intellisense feature (a.k.a. auto-complete) of this nice IDE. The only thing is that it’s very slow to start and I had a hard time installing the debugger. Well, now the PHPEclipse package also provides the same functionalities with a complete debugger for FREE.

This is the first time I try Eclipse. My impression: impressive! The IDE loads faster than the Zend 5.1.0 IDE, eventhough both run on Java VM. The GUI of Eclipse is also slicker and it gives me the feeling of working in Visual Studio again. Installing the PHPEclipse was a breeze via the Find & Install featured under the Software Update menu. However, installing the php_dbg with Xampp wasn’t that straightforward.

At the time of writing, the php_dbg.dll is only available upto PHP engine version 5.1.2. The newest Xampp is 1.5.4, which bundles the PHP version 5.1.4. I would recommend you to install the older version of Xampp instead. Xampp 1.5.2 is the one with the correct PHP engine to work with php_dbg.

First of all, copy the php_dbg.dll-5.1.2 to the [installed xampp’s dir]/php/ext/. Then add the following lines to the php.ini file. the php.ini file that Xampp’s Apache is using is in the [installed xampp’s dir]/apache/bin/php.ini. You can see the actual path if you do a quick phpinfo().

[debugger]
extension=php_dbg.dll
debugger.enabled = true
debugger.profiler_enabled = true
debugger.JIT_host = clienthost
debugger.JIT_port = 7869

However, the default configuration of the php.ini will crash your Apache because of the loaded ZendExtensionManager.dll. What I did to solve the problem was to comment out the zend_extension_ts lines towards the end of the php.ini file like this…

;zend_extension_ts = "I:\Program Files\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"
;zend_extension_manager.optimizer_ts = "I:\Program Files\xampp\php\zendOptimizer\lib\Optimizer"
;zend_optimizer.enable_loader = 0
;zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
; Local Variables:
; tab-width: 4
; End:

After all the zend_ lines have been commented out, Apache started just fine and the phpinfo() dump confirmed that the php_dbg has been loaded.

Hope this help. Now it’s time to do some serious php apps with PHPEclipse. Ah by the way, CakePHP with PHPEclips is beautiful! We now have full code auto-complete for the CakePHP’s library! How amazing! And my friend Giao has just told me that Jseclipse for Javascript now support autocomplete for OOP-JS (prototypes and all that good stuff). Ha, it looks like that I’m hooked with Eclipse already.

view comments
 

I just updated the scripts on www.lastproxy.com, both the CGI (nph-proxy) and PHP (php-proxy.php) flavors. While installing the php-proxy.php was just an upload,go, and forget, configuring the nph-proxy.cgi script on 1and1 is quite tricky. I called up the 1and1 support staff and the guy seems to be really nice, but clueless about what to do.

Well, to get nph-proxy.cgi to work on 1and1, you have to do these following

1. Upload nph-proxy.cgi as ASCII
2. Chmod the script to 755 using any FTP client (e.g. FileZilla)
3. The default #! usr/bin/perl line of the script works just fine with 1and1 so you don’t have to worry about it.
4. To actually get the script working, change the extension from .cgi to .nph
5. Point your browser to the script, bam, things just work!

For some servers, they use the prefix nph- to signify the PERL engine to not parse the header (nph stands for non-parse-header). My guess is that 1and1 server configs to use the extension .nph to notify the PERL engine instead.

I hope that this saves you some hassles getting nph-proxy.cgi to work. Last of all, check out my proxy page at http://www.lastproxy.com
LastProxy logo

view comments
 

After surfing around sitepoint.com for a few days, I decided to put up my own proxy site. If Intel have Core Duo 2 (shouldn’t it be Core Quadro or something?), then my site should have dual-proxy — both PHP and CGI flavor.

Besides the regular features of the proxy, I’m thinking about adding countries IP-filtering, which should not be too hard to implement becase the documentations at Maxmind have the code exerpt. So it’s a matter of tweaking the script to work with my site. In light of a site-auction at sitepoint.com forum, .htaccess will also be added to avoid hot-linking. I think there are tons tutorials on how to do this.

Below is a screencast (gif!) of the template is below … I’m pretty happy with the result so far. The design process went really well and I have to admit that I LOVE my stripedesigner.com site. It’s awesome! Can you tell what stripes did I use for this particular design?

LastProxy

Comments are welcome as usual. :)

view comments
 

view comments
 

Today is quite a productive day for me, not for schoolwork but personal research on the Web 2.0 Stuff. I still have a semester-long Inorganic Lab notebook to finish and turn it in by the end of this week. I will be leaving soon to work on that but I cannot resist the temptation to type this little report up, especially after I just did a quick Ajax experiment on low-lag client/ server communication (see my previous post.) Ajax works but fails when it comes to low lagging. So how come Meebo, Gtalk, and Gabbly can do this ultra low-lag? What is the special technology/ platform are they running?

Gabbly
I went to Gabbly and at the time, there were 2 people who claimed to be from Gabbly: Jon & Abe. I asked them about what webserver Gabbly was running on and there was no answer from them. Well, this is understandable as Gabbly is their (not verifiable) product. Anyway, using FireBug (a FireFox extension), I was able to see the request made from Gabbly. The header tells the whole story:

Gabbly Firebug Header

They are using Apache-Coyotte 1.1 as their web server!

How Gabbly Works: Ajax & JSON
I think this is how everything works, the comet way: Basically the page constantly making request to the server. The connection is kept-alive (will be the buzz word soon!) for a x amount of seconds (30 secs?) After this period, the server flushes the data back to the client. The client receives the ajax response in JSON format, which most of the time is empty (firebug says that it’s “not well-formed”) as nothing is returned.

Gabbly not Well-formed

On the other hand, if there is any new data, a sample JSON object being flushed by the server is:

Gabbly Response

The client, after receiving the JSON, will get busy right away by making another request to the server, waiting for more contents to be “pushed”. Of course the ajax engine will be parsing the JSON object to display the message to the user. Yay, happy communication.

The Problem
The ultimate question is: how the server can handle multiple keep-alive connections? There’s an article describing this problem, a.k.a the C10K problem (http://www.kegel.com/c10k.html). C10K means the server has to serve 10,000 concurrent connections. Apache is said to quickly fail this task as the server keeps forking (making a copy of itself) to handle more connections. After awhile, apache can consume all the system resource: game over. Obviously, for Comet to work, a new type of web server needs to be developed. Luckily, Gabbly has proved there is indeed a solution by providing a working product. But they are running Apache-Coyotte 1.1 as the header says. Truthfully speaking, I have no idea about Tomcat/JSP. I do know Java and J# but using Java for web, in my opinion, is an overkill and anti-cost effective for small web developers.

The new million-dollar question is: how the rest of the world, where PHP is the champion, can use Comet?

Meebo
I think Meebo is THE example of Comet applications. It’s fast and a pleasure to use. It can very much be used as an alternative to a desktop IM application. Quickly comes the C10K problem again. But again, if there is no viable and sound technology fundamental, Meebo won’t be able to exist and got funding from the california venture capitalist firms (I do monitor the VC news closely to see the trend of the web!) I did a little investigation using Firebug and I found the multi-dollar answer to our question.

Meebo Response

The (hopefully) million-dollar answer: Lighttpd comes to the rescue. (And later on we expect to see Apache with its mod_mpm too.)

Ah hah! Lighttpd comes to the rescue! I quickly went to Lighttpd website and looked up the Features List: Lighttpd is indeed built for high concurrency. And more importantly, Lighttpd can fully support PHP. YAY for the opensource community and for me myself. I’ve been having an idea about a project that heavily involves Ajax and Comet. If I can use Lighttpd for Comet, then I can use PHP, and I am confident that my project is viable as I now have the fundamental technology to support my idea.

Again, we see the familiar JSON object from the Meebo server response. And similar to how Gabbly works, the web browser open up a connection right away to wait for new data to be pushed.

That’s it…
Well, that’s it for today. I have to go and start on my Inorganic Lab notebook. 2 more days till freedom. 2 more weeks to graduation and I’ll be done for good. I hope that I did answer your (and my) question about how Gabbly and Meebo work and the support technology behind.

PS: Comments are very welcome!

view comments