Hours of Operation

RSS

Rewrite code for redirecting all traffic to www subdomain (htaccess & apache conf)

I pretty much always forget this. Here’s how:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com
RewriteRule ^(.*) http://www.example.com/$1 [last,redirect=301]

Plugin for ServerDensity for monitoring PHP errors

Here’s a tiny little plugin written in Python for checking and reporting php error log file sizes to Server Density. Modify it to your needs…

Getting rid of PHP errors after install Zend Server CE

You may experience strange PHP errors after installing Zend Server CE. Examples:

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626/pdo_mysql.so’

The solution is to remove the built-in CLI version of PHP and add Zend’s PHP to the path:

sudo aptitude remove php5-cli

Add this to root user’s /root/.bash_rc to make Zend’s CLI version available system-wide:

LD_LIBRARY_PATH=/usr/local/zend/lib

PATH=$PATH:/usr/local/zend/bin

The greatest geek who ever lived

May 9

Introducing the Mozajik Loader plugin for Wordpress

Some sites have complex data needs (where a framework like Mozajik does a great job) while also requiring a simple CMS for publishing news and updating site content (which is what Wordpress does best).

Introducing, the Mozajik Loader plugin for Wordpress 3.x+. It allows you to load up the Mozajik framework and display any framework-based data or content inline.

See the docs and download it from Github.

May 9

Enable Wordpress multi-site option

Multi-site enables you to have a single Wordpress installation for several different sites.

http://codex.wordpress.org/Create_A_Network

May 9

OSSEC performs log analysis, file integrity checking, policy monitoring, rootkit detection, real-time alerting and active response

May 8

Version control for clients who don’t know SVN or Git

Some of our clients want to modify HTML templates in their projects which we keep under SVN version control. We do not want to torment our clients with learning SVN or Git so this means that any changes they made were not committed into the version controlled source…until now…

The solution: combining Dropbox and SVN.

  1. Check out a copy into Dropbox and share with your colleagues.
  2. Create a new empty shared folder with the client.
  3. Create symbolic links in the empty folder pointing to the various folders you want to give the client access to (for example template and asset folders).

This solution achieves these goals:

  1. Any change the client makes will automatically be transported to the working copy of each developer working on the project.
  2. One of those developers can commit the changes into SVN.

In such way, all changes made by the client eventually find their way into the Subversion-controlled repository…

May 7

My typical rsync flags

I always forget the proper flags and options for rsync, so for reference here is what I typically use:

rsync -avz —progress —stats —human-readable /source /dest

Progress, stats, and human-readable make the output nice. “a” turns on archive mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc are preserved in the transfer.  ”v” makes it more verbose. “z” compresses the data during transfer.

Other options:

-e ssh     # Good when you want to transfer between servers

—del      # This will delete “orphaned” files in the destination

—exclude=”_log/*”    # It excludes the pattern. You can have many.

May 6

“No such file or directory” even though the file exists

I was trying to run a binary program under Ubuntu and this happened:

Clearly, the file exists, yet it says it doesn’t. Strange.

It turns out that the binary is a 32bit application and my distribution is 64bit - and this is Ubuntu’s (or rather Linux’s) cryptic way of telling us that it cannot run the file…

The solution is simple, install 32bit libraries via aptitude:

aptitude install ia32-libs

(Source: serverfault.com)