Rackspace Magento Hosting Post Mortem

One of my Magento clients ran into a bit of trouble with their current hosting provider. Stability was not up to what it was supposed to be, there were security issues that raised concern, and support was slow and indifferent at times. The client is a retailer that gets significant traffic spikes during shopping season and when doing promotions. The infrastructure of the current hoster was not flexible enough to deal with huge traffic spikes in an automated fashion.

We decided to switch to a different hosting company to improve the situation. We looked into a bunch of companies and ended up giving Rackspace Magento Hosting a go.

This post is a post-mortem of a failed attempt to switch our hosting provider.

Continue reading “Rackspace Magento Hosting Post Mortem”

Rackspace Magento Hosting Post Mortem

PHP – Get method definition from object instance

When debugging complex applications you sometimes need to find out where a method of an object instance has been defined. With several levels of inheritance this can sometimes become quite time consuming. This is where PHP’s Reflektion API comes in handy. This API allows you to reverse-engineer classes, functions & methods.

$foo->bar();

If see in your code that an object instance $foo calls a method bar and you want to know in which file bar is defined.

You could use get_class($foo) to find the name of the class, then find the class definition in your code and then go backwards through the classes the class inherited from, to find the method definition. Using the Reflektion API allows you to find the file in one step.

$rc = new ReflectionClass($foo);
$method = $rc->getMethod('bar');
echo $method->getFileName();

Have a look at ReflectionMethod for more details.

PHP – Get method definition from object instance