Optimizing server running Magento

Obviously the actual value depends on your hardware and website. These settings are for 3g RAM server. Might tweak further with more statistics coming in.

my.cnf of mysql

key_buffer = 256M
max_allowed_packet = 32M
myisam_sort_buffer_size = 32M
tmp_table_size = 64M
table_cache = 512
sort_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 2M
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 2M
thread_cache_size = 8
innodb_buffer_pool_size = 128M
innodb_thread_concurrency = 6


KeepAlive on
KeepAliveTimeout 2
MaxKeepAliveRequests 100

Note: setting innodb_buffer_pool_size will cause innodb to fail

Trouble with Magento Extension Install? Try manual approach

Sometimes Magento refuse to install extension via Magento Connect. But you can always try to convert the extension to actual package and overwrite your existing installation. Of course, use with caution.



BTW so far I don’t like Magento.

PHP: auto set and get through magic call

This is how to set and get automatically through magic function in PHP.

class myClass

    public static function __call($method, $args)
         * Set to only responde to set and get method calls
        if (preg_match('/^(?P<action>set|get)(?P<property>.*)/', $method, $matches)) {
            $action = $matches['action'];

            $property = $matches['property'];
            $property[0] = strtolower($property[0]);

             * Set to only respond if the called property exists
            if (property_exists($this, $property)) {
                switch ($action) {
                    case 'set':
                    $this->$property = $args[0];

                    case 'get':
                    return $this->$property;


                return $this;