Friday, October 29, 2010

JSON with Apache, Centos 4.4 and PHP 5.1.6

Although CentOS 4.4 and PHP 5.1.6 sounds a little ancient in these days, it can happen even in the best family when suddenly you're realizing one day you have to work with a configuration like that in order to keep a development environment entirely compatible with a live system (which is totally reasonable).

It's quite easy to upgrade Centos 4.4 to PHP 5.1.6 and it's also easy to add PEAR, PECL and JSON.
It's not necessary to mention how easy to add the JSON.so module properly to the CLI version of PHP and to Apache as well - here is a good description for that.

So now you have PHP 5.1.6, Apache2, Centos 4.4.
You type PHP -m and you see the JSON module is loaded.
You run the webserver on a page which containts PHPINFO(); and you can see the json.ini file is loaded.

But hey! The Webserver doesn't loads the .SO! What's going on?

It took me a couple of hours to figure out, and since I haven't found this solution, I'll provide it here - hopefully Google will cache it for other poor souls trapped in the same way and save a couple of hours for them.

The solution is:

cd /usr/lib/php/modules (or your modules directory where the json.so file is)
strip json.so
apachectl restart


As you can see, in some cases Apache doesn't loads unstripped shared binaries so you need to fix it manually if your scripts and compiler didn't do so already.

Enjoy!

Sunday, June 27, 2010

Extending a mixed Time Capsule / Airport Extreme Network

DSL Router -> Airport Extreme -> WIFI -> Time Capsule

Time Capsule CAN join to an extended (WDS) Airport Extreme network just like any other Airport Extreme device, but manual setup often says "This network cannot be extended". The real problem is the discrepancy between the manual and automatic configuration options. So instead of manual setup, press continue (or 'assist me') and go over the functions. Just ignore the first 'ethernet is not connected' part.
Everything should work fine in this way.

Sometimes the time capsule backup will work only if the name of the device is short and alphanumeric only (no space or any special characters).