Book Image

Instant Magento Performance Optimization How-to

By : Nayrolles Mathieu (USD), Mathieu Nayrolles
Book Image

Instant Magento Performance Optimization How-to

By: Nayrolles Mathieu (USD), Mathieu Nayrolles

Overview of this book

The optimization of an attractive commercial website is a non-trivial task that demands time and knowledge. Optimization is a critical point for all growing businesses because a misconfiguration could make you lose money, a lot of money. If your server is overloaded, a browser that wants to turn into a buyer will not be able to, and you will lose customers. "Instant Magento Performance Optimization How-To" is a practical, hands-on guide that provides you with a number of clear, step-by-step exercises to help you reach a high performance level for your Magento stores and keep your customers satisfied.This book looks at tweaks and tips used to boost your Magento Performance, and breaks down the confusion that surrounds the subject.You will learn how to compress your pages, styles, and scripts by almost 80%. We will also take a look at controversial optimization settings such as Magento core compilation or enabling all caching systems. You will discover new applications that improve performance. If you wish your e-businesses to grow and want to keep your customers satisfied, you definitely need this book.
Table of Contents (7 chapters)

Using a debugger (Should know)

In this recipe, we will install and learn how to use Xdebug for debugging our development system.

Getting ready

If you are on a Unix system, type the following command to install Xdebug:

sudo pecl install xdebug

If you are on a Windows system, you can download a compiled DLL from and place it under the ext directory of your PHP installation.

Then you have to add the mapping in your php.ini file.

For Unix, add the following mapping:


And for Windows, add the following mapping:


After restarting your web server, you can create a file named phpinfo.php that contains the following:

<?php phpinfo(); ?|

Place this file at the root of your web server and browse to it. If everything is fine, the Xdebug extension should appear twice. The first one as a Zend extension, and the second as a PHP extension.

You now have an improved var_dump () function and your error messages from PHP. Of course, this only works if the Show errors option is turned on.

How to do it...

We assume that you already have an Eclipse instance up and running; if not, go to and get the latest version (Juno SR1). Then install the PHP Development Tools (PDT) in Eclipse by navigating to Help | Install new software and search for PDT.

When PDT and Eclipse are successfully installed in your development environment, add the following lines after the zend_extension line added in your php.ini file (See the Getting ready section).


Once again, restart your web server. In Eclipse, the only setting you have to change is in the Debug Configurations window of PHP applications: set XDebug instead of Zend Debugger in the Server Debugger drop-down menu.

Hit the Apply button and then the Debug button on the same page. Eclipse will open a debug view like it does for any Java applications. In this debug view, you will be able to see and modify variables at runtime and show/add breakpoints.

How it works...

If you have followed all the previous steps, Xdebug will now control the execution of your PHP programs. It means that it can pause and restart the execution of any program. When the program is held, Xdebug is able to retrieve any data belonging to the program and modify them, on demand.

Throughout these recipes, you've learned how to use some powerful tools that will help you debug your Magento during the development period. Do not forget to disable all debugging options when you put your website into production, such as Xdebug or the template path hints.

With Instant Magento Performance Optimization How-to, you are all set to complete the non-trivial and complex task of performance optimization. Indeed, you have made our Magento go at the speed of light by reducing the time to display a page by almost 75 percent. You are also ready to cluster your own environment. Moreover, you've now learned tools that can help you locate the problems in your Magento installation.

I would like to give you my heartfelt thanks for reading this book and hope that there are more satisfied customers out there.