Category Archives: Hacks

Writing Twitter Bot, the “intellectual one”, in php

Hacks PHP Thoughts

What is Twitter? For many it is a place to brag about everyday life events and post pictures. Some use it to promote themselves, corporations and alikes try to provide “customer service” using Twitter and other folks are doing all sorts of things from selling knock-offs to completely illegal stuff.

This article is about how you can use Twitter to promote a site, service or anything you’d like to the tweeps.

It is apparent, that searching for a keyword or a key phrase and responding to all of those would take a lot of time, so we are going to use automated scrip (a twitter [ro]bot), which will do all the job for us.

continue reading »

Installing Windows 7 with Silicon Image 3112 RAID Controller – where to get the right driver?

Hacks

Windows 7 is definitely an awesome piece of software. Sounds funny when such words come out from me, Apple hardware and software fan. Yet, this post is about troubles i had while setting up Windows 7 on a client PC with Silicon Image 3112 RAID Controller.

Despite Windows 7 being aware about most of the drivers for most of controllers it did not recognize my RAID card when booting from the installation DVD. After googling around and looking for the right driver on numerous forums, i found two places: an official Microsoft forum post and Station-Drivers.COM page. Some of the posters suggested that you need to update your controller’s BIOS in order for the driver to work, however in my case it was not necessary. After a few tests with different versions of drivers from Station-Drivers.COM i finally succeeded. continue reading »

Apache vs. Nginx – testing performance under heavy load

Hacks Hosting Reviews

It has come to my attention, when a client of mine recently experienced unexpected traffic spike, that some industry standard solutions not always work or should i say not 100% reliable all the time. My client’s server setup was an-old-school Apache 2.2/mod_php WordPress blog installation. One day they posted some “hot-buzz” celebrity photos and server had become non-responsive under the traffic flow. Of course, at that time i was unaware about high-availability setups and never imagined scenarios like this one, when you get monthly volume of visitors during the 24 hour period.

Since then i have researched a lot of places online and found, that Apache web server is not the only solution to the hosting setup problem. Many others exist and those others, event quite “beta”, allow for the great tolerance for the high volume traffic.

Today i’d like to share with you my test results for my current server setup – LEMP or Linux, nginx (Engine-x), MySQL, PHP-FPM versus my old setup for this blog: LAMP – Linux, Apache, MySQL, PHP. Both of those are on the Linode VPS (Linode 360). Before getting rid of the old server configuration i booted it one more time and ran tests using guys from LoadImpact to determine how will each of these survive under the load of 10-20-30-40-50 simulations requests.

continue reading »

Zip a folder on the server with php

Hacks Hosting PHP

zip icon

I have a spent a day today figuring how to zip a client’s web site folder on a Godaddy shared Linux hosting today (they made sure users don’t have SSH access on those) in order to transfer it to another server. Apparently, given the limitations of the account setup the best way was to write a php script by executing which i would zip the given folder contents, so that then i could copy just one file and unzip it on the target server.

And it can’t be easier than that – if you have a folder, which contains a number of other folders and files in them the script below lets you add to the zip file quickly and easily:

continue reading »