Setting up Magento Environment for Development

Magento is one of the best open source e-commerce platforms out there. It is packed full of great features and allows for almost unlimited flexibility and customization. We need to set up our development environment properly, Before we start do the development.

This environment will make your life easier by turning off caching so you can see changes immediately, turning on error reporting so you can see what went wrong, turning on logging so you can capture valuable debug information, and other helpful things like extending the admin session so you don’t have to constantly log in and a whole lot more.

I assume you have the latest version of Magento installed. If not start by downloading and installing the latest release of Magento from magentocommerce.com.

Setting the Time

The first thing we want to do is make sure that our Magento installation and server have the

appropriate date and time. If your server time is too far into the future or past it breaks a

core functionality in Magento and in some cases prevents you from being able to log in in.

Make sure your date/time is properly set by opening a terminal on the server hosting

Magento and type, date .

If your date or time is off, this command will get it back in sync if you have ntpdate on your

system:

 

Turn Caching Off

Nothing is more frustrating than making code changes expecting a different result only to find out that caching has been turned on the whole time. When developing your extensions you should always have caching turned off.

Login to the backend, go to:

System > Cache Management > Select All > Disable > Submit

Click Flush Magento Cache

setting up magento environment for development.png
setting up magento environment for development.png

Turning Error Reporting On

By default Magento tries to suppress error messages. In a production environment this is a good thing; however, for developing we need error reporting enabled.

Open up index.php and uncomment:

Then set Magento to Developer Mode by changing:

to this:

Open .htaccess and set: SetEnv MAGE_IS_DEVELOPER_MODE “true” at the end of the file.

 

Turn Logging On

We also need to have logging turned on.

System > Configuration > Developer

Expand the Log Settings

Change to Enabled and leave the names default.

Extend the Session Timeout

Magento has a default session timeout of 15 minutes which means you will be logged out of the admin backend every 15 minutes which is quite annoying during development. Extend the timeout by going to:

System > Configuration

System > Advanced > Admin

Expand Security

Default is 900 seconds which is 15 minutes. Set Session Lifetime (seconds) to 86400.

This will log you out of your current session but next login will stay connected for 24 hours.

Depending on your server configuration you may also need to set your max-lifetime session expiration time in your php.ini file for this to have an effect.

 

Surely there are many more tweaks and configurations to be done in order to fully prepare your Magento development environment. The above is merely a list of some of the more usual stuff that you should address before diving into the code.

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


*