Friday, September 10, 2010

Problems (And Solutions!) While Creating a Local Magento Install with Wamp

To continue my foray into e-commerce shopping cart solutions, I decided to start tackling the beast that is Magento. Here are some of the problems I encountered, and the solutions I found for them.

After doing several frustrating re-installs of Magento using Wamp that took up approximately 1.5 hours of my life that I will never get back (that is assuming I never get my hands on a DeLorean) I have finally wrangled my way into the admin section of my local Magento install. Here are some of the simple solutions I came across that may prevent some of your future headaches.

Note: This install uses Magento on a personal computer that only I use for development.

First, Magento is quite large. By default, Wamp has some settings set in its php.ini file that limit how large of a script can be ran, and how long before it will time-out. These default values are too low for Magento to finish installing, so we need to change them. Your php.ini file is located in Wamp/bin/php/phpx.x.x (where x is your version of php you have installed). After several attempts, I changed several variables to be quite large to allow Magento to install its database without timing out, or running out of space. Open your php.ini file in the text/code editor of your choice and use your find feature to locate "max_execution_time". It will be part of a block of code that looks like this:

; Resource Limits ;

; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 1800 

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
max_input_time = 6000

; Maximum input variable nesting level
;max_input_nesting_level = 64

; Maximum amount of memory a script may consume (128MB)
memory_limit = 512M
As you can see, I changed my max_execution_time to 1800, my max_input_time to 6000 and my memory_limit to 512. There are several sites that suggested this, however, most of them fail to mention that you also need to change your php.ini file in your Apache folder. So, this file is located in Wamp/bin/apache/Apachex.x.x/bin. Using the find feature of your text/code editor you can change these values to match that of the one in your Php folder. Be sure to restart Wamp after changing these values before you attempt to install Magento.

After this problem was solved, I was ready to start tinkering around with the admin. However, each time I entered my password it came back as invalid. And since it was a local install, I could not use the e-mail feature to have it sent to me. First, I attempted to Google the problem, knowing that I definitely had the right password after reinstalling more than once. I got a little distracted by this thread on Magento's forums explaining how to change several files to get Magento to recognize the http://localhost/Magento type of address that you would use for a local install. (by the way, if you do encounter this problem, see the thread for more details, but using instead of loalhost may fix your problems).

Here is where I had a "duh." moment after unsuccessfully getting any of the changes mentioned in that thread to work. Thank you for reminding this database specialist student that yes, you can change your Magento password via your phpmyadmin interface.
In rare cases your login data might be the real problem. You can set your password via phpMyAdmin and the following SQL-Statement:

UPDATE admin_user SET password=MD5('newpassword') WHERE username='yourusername';

I'm sure many of you are tee-hee-ing to yourself that I must have mistyped my password, but after several re-installs I have to protest that this simply isn't true! /end frustration.

Happy Magento-ing.

No comments:

Post a Comment