One of our servers was running out of space, turns out it was the Mysql Binary Logs which were starting to eat up lots of space. Managed to purge the logs by first checking the list of files:

Which gave me

I then logged in as the root mysql user and ran the purge command:

And what was left over was:

Turns out Magento was a bit confused by using SSL Termination on the Rackspace Cloud Loadbalancer. It ended up doing an endless 302 redirect loop which the browser eventually cut off with the message “The page is not redirecting properly” in Firefox.

Turns out Magento was expecting a connection with SSL but because the Loadbalancer had terminated SSL already it would redirect the user back to the https:// address, thus causing an endless loop.

It was quite simple to fix, but some of the recommendations I found online didn’t quite work for me, until I added an extra if to make sure the proto was indeed https. You add this above the line Mage::run($mageRunCode, $mageRunType); at the bottom of your index.php. I have left my run command in as example.

I got tired of doing this manually each time so wrote a little script. This works on a Mac Mini but should work under Linux as well. It adds tags, branches and trunk dir, then checks out the Repo to the Sites directory. It even adds a post-commit file which will make sure that on each commit the version checked out on the server is updated automatically..

This one’s pretty handy if you’re filtering lots of data output from a find or php output for example.
In my case it’s a php script outputting massive arrays (about 3000 of them) and I wanted to find a few rows beneath each line where a certain word was found:

This returns 3 lines after the line with mysearchterm.
If you also want to add the 3 lines BEFORE you can add -B 3 like so:

UPDATE: This is now outdated. You should have a look at /etc/default/hhvm which will point to /etc/hhvm/server.ini. It’s a lot easier and upgrade-safe than the post below.


Turns out HHVM (HipHop Virtual Machine, made by Facebook) is fairly usable in it’s current state. To quickly get up and running with something that works you don’t even need to install a webserver (although it is recommended if you want to offload static files and add gzip compression).

For Debian 7 you can use the following lines of code:

I strong recommend editing the /etc/init.d/hvvm to allow it to listen to port 9000 so we can use it as FastCGI (like PHP-FPM). If you are familiar with PHP-FPM in Nginx for example this should strike you as ideal: it’s basically a drop-in replacement for PHP-FPM! This blog is now running on hhvm but the other sites on this VPS are still running under PHP-FPM through socket.

Open your /etc/init.d/hhvm and add the following to the command:

Mind you this will break with each update, Facebook is still looking into making a FastCGI version of Nightly which does not change this file.

Here’s a complete copy of my /etc/init.d/hhvm