Posted on

Fixing Magento Login Problem after a Fresh Installation

This is just a quick little note to suggest two ways to solve the problem that you cannot log in to your Magento admin interface after a fresh install of Magento.

The Problem

The problem will manifest itself as a redirect back to the login screen, even though you typed the right username and password. If this problem is affecting you, you will be redirected back and see no error message. This indicates you have the right credentials, but the Magento Admin is just not letting you in. You can verify it by typing the wrong username and password, you’ll see you get redirected back and it shows an error message.

The problem occurs because the Magento backend tries to set a cookie on your browser, and then for some reason when you next make a request, the cookie is gone(or was never there). This makes Magento think you have never logged in, and of course it redirects you to the login screen. So the real guts of it is the missing cookie, we need to find out why it’s missing.

There are two three solutions (Update: now with bonus 3rd solution) I have come across that will solve this, there may be others too, so please feel free to post them below. Both of these solutions have been suggested in the comments of my post on Setting up Apache Virtual Hosting.

Solution 1: Domain Name with no dots

This is the most common solution, if you have set up Magento to run locally (on MAMP for example) then you may be accessing the Apache webserver using the localhost hostname. A security setting in browsers means that the cookie will not be set, though apparently in FF3 at least, this behavior is a bug?.

So simply stop using localhost, you can use your localhost interface (e.g. 127.0.0.1 or 127.0.1.1). To determine your localhost interface you can look at the contents of your hosts file:

# Look for the number to the left of localhost
cat /etc/hosts

or your interface configuration.

# Look for interface loX with the LOOPBACK flag (probably lo0)
ifconfig

Once you know which number to use, you can replace localhost with the number. If you have already installed Magento using localhost then it will keep writing out links to localhost, even after you have changed to using the IP address, you will need to change the base_url values in the core_config_data table, you can run a query like this to find the right config values to change:

SELECT * FROM core_config_data WHERE VALUE LIKE "%localhost%";

This should identfy two config values that will need to update with a query like:

UPDATE core_config_data SET VALUE="http://127.0.0.1/" WHERE path IN ('web/unsecure/base_url','web/secure/base_url') ;

I’m going to assume you know to put the right value into that query, and not use the example one I have provided!

After changing that value you should delete your var/cache contents, and then refresh the page. Now you should have Magento running on an IP address, not a hostname with no dots in it. Of course you could always set up a fake domain name like www.testing.com by using a Virtual Hosting setup like I describe in my post on how to configure a MAMP Virtual host.

Solution 2: Timezone differences between server and client

One other, less likely problem, is that the cookie is being set, but expiring immediately. To check this you can inspect the cookies your browser is holding, and check if there is one there from Magento. If there is then check both the timezone your magento installation is using , and the one you have set locally, perhaps your local time is not set properly?

Solution 3: Cookie domain does not match server domain

This caught me out when I was replicating a remote site on my local mac development environment. I thought it’d be worth adding this solution here, seeing as this post still seems to rank well for Magento install problems. I had changed the base URLs but had forgotten to check the core_config_data table for any other Magento configuration data that might have been interfering with cookies. The config path in question is: web/cookie/cookie_domain.

You can check the table with an SQL command like this – you should be on the look out for config values that have hard coded the old URL:

SELECT * FROM core_config_data WHERE VALUE LIKE "%domain.com%";
 
-- Be on the look out for something like this:
|       513 | DEFAULT |        0 | web/cookie/cookie_domain               | DOMAIN.com                                     |

And update it to an empty string (less secure) or the new actual domain (more secure) as shown below:

UPDATE core_config_data SET VALUE = "" WHERE config_id = 513;
-- or
UPDATE core_config_data SET VALUE = "domain.com" WHERE config_id = 513;

But wait, there’s more….

Thanks to Kristof aka Fooman for this gem:

Th solution here is to clear all your cookies related to the store domains and subdomains.

And yet still more possible issues, this time from Mauro Spivak:

This is an example of the more general issue that sessions are not able to be created. That could be because local.xml is instructing Magento to store them in a non-exsistent location such as in Maruo’s example – or may also be caused by permission issues on the filesystem when storing sessions in var/session. I’d suggest checking there is a session matching the session ID for your cookie to see if this issue is affecting you.

Hopefully one of these two three four solutions will get you back on track and able to log in to your newly installed Magento. Feel free to post problems or suggest other solutions in the comments below. I’m always more than happy to update my posts with helpful tips from readers.

Posted on

Simple Helix Magento Hosting Review

Right, so after over a month of putting this off I’m finally going to start writing some Magento Hosting reviews. The first is for Simple Helix. You might remember way back in April when I said I would be reviewing a few Magento hosts, and also running a free Magento hosting competition.

The competition is now over and I will be announcing the winners shortly, thanks to everyone who entered! I’ll compile the list of hosting annoyances you sent in and post it here shortly too. Just to re-iterate my thanks to the two hosting companies that put up prizes, A2 Hosting and Nexcess Hosting.

Enough about the competition, on to the Magento hosting review of Simple Helix hosting. I look at an installation from the point of view of someone doing them all the time. There are a few things I really like about hosting providers in general, the first is SSH access, especially the kind that’s granted by default when signing up. Simple Helix thankfully provide simple clean SSH access (not the ugly cPanel style java applet), which is something that I really appreciate. The other thing I find really helpful is the welcome email – hosting providers always send a welcome email. From a technical point of view I just love it when hosts lay out all of the hosting information in plain text, so I can easily copy paste it, without trawling through screens of fluff. Simple Helix scores points on both of these factors. But I’m sure if you don’t sign up for hosting every month, these kind of things are one off and you don’t really care!

I bet what you do care about is speed, disk space and bandwidth (and possibly support?). So here’s my take on those factors. My initial reaction to the speed question was wow, good – their server pulled the Magento install down at 6MB/s – that’s close over a 10Mbps pipe, so I can tell right away that they have decent internet facing bandwidth. Another indicator of speed is the unzip of the Magento package. If it’s almost instantaneous then you know the hardware is modern, with Simple Helix this was the case. So I knew they had a decent connection and decent modern hardware. The only other question is: how many people do I have to share with! Because that really decides what kind of performance I will get.

Being in New Zealand it’s always difficult to judge exactly how quickly a page will load for users in the Northern Hemisphere. That said, I found the Simple Helix pages loaded really quickly even way down under, and I know there are reports of that not being the case for everyone. One thing to consider is that some users may forget to enable caching for Magento, which is a sure fire way of slowing it down 3-4x, so always enable caching on production installations!

Database setup was incredibly easy, they do not use the standard cPanel style interface, so the usually 3 step process was made simpler and much easier, probably really helpful for people doing their own installations that are not familiar with hosting panels.

The last thing I noted was that Apache mod_rewrite was enabled by default, which I know may seem like an absolutely obvious thing for a hosting company, but I have been surprised by the number of them who do not do this! It is important for Magento SEO to have the rewrites enabled, and to use them, it’ll mean your URL’s can be of the form yourdomain.com/my-keyword-loaded-product-name.html which will help (hopefully).

The price and specs of their plans; $20 for 50GB bandwidth and 5GB of storage and $50 for 100Gb of bandwidth and 25GB of storage are definitely at the upper end of the shared hosting spectrum. In fact for $75 per month you can actually get an Amazon EC2 server, which is what I do personally and highly recommend. I am working on an EC2 AMI for a pimped out version of Magento (with extremely high performance, data security and ease of use) – details to follow in the next couple of weeks.

So what’s my conclusion, Simple Helix Hosting seems professional, modern, speedy and well configured for Magento. Their plans are $20 or $50, which is on the higher side, but it seems to me they’re worth it. If you’re in the market for Magento Hosting, Simple Helix are well worth trying out.

Update: I just want to add that this review and my recommendation of Simple Helix is based on the short time I spent setting up and testing Magento on their platform. I have since read a fair bit of negative feedback about the stability of their hosting and I can’t really comment on this because I didn’t experience it. So please keep this in mind when you are considering my review. Also, I will add that I’d always recommend doing your own backups and not relying on your hosts backup support.

Posted on

Whoops: Magento supports PHP 5.2.0 or newer

You need to run PHP 5.2.0 or newer for Magento. This is normally not a problem for MAMP but a recent reader has asked about determining which version is running on their Mac when this error does occur. I just wanted to make a quick post on checking PHP versions in MAMP, because it seems if your Mac has other versions of php installed you can end up having odd results when trying to run Magento in MAMP.

You can determine which PHP version your MAMP server is running by opening the MAMP ‘start page’ and clicking the phpInfo link in the top menu. This will also tell you which php.ini file is being used.

You can also run:

 php -version

Run this in a terminal (Terminal.app), to print the PHP version that is on your PATH. You can determine which php is being run by typing:

which php

To find any php binaries on your Mac you can run the locate command in a terminal:

locate php | grep "[^\.]php$"

The pipe into grep just filters out any files that have php in the path, but are not php binaries, and also removes any files that are of the form filename.php which would otherwise turn up in the search.

You can execute any of the php binaries this command finds with the argument -version to find out what version of PHP it is. This may help you to identify any versions of PHP you have installed that you do not want anymore.

For example:

/usr/bin/php -version
/Applications/MAMP/bin/php4/bin/php -version

If anyone has any other tips for solving this or questions please post them below. Hopefully we can make sure this problem doesn’t trip anyone else up!

Posted on

Another Magento install success, Only 2 Free installations left!

Well I have finished another of my free Magento installations and have some more excellent feedback to share. I helped Alan Bold with his Magento installation and here is what he had to say about my work:

“Building a Magento E-commerce site for the first time is tricky! No doubt about it. My biggest worry was web-server and web-hosting performance. Fortunately I came across Ashley’s services and took up his offer of a free Magento installation. If I had to sum up the experience in one word that word would be professional, others could be: fast, efficient and cost effective. Ashley took time to answer all my initial questions and reviewed my chosen web-hosting package. His install was quick (much faster than my test server install) and worked great. I was left with peace of mind that everything was configured correctly and secure, for this alone I will be using Ashley’s service for future Magento sites. $99 is a bargain, cheaper than Magento and well worth it. Thanks Ashley and keep up the good work”

Thanks for the kind words Alan, I look forward to working with you in the future. For any readers interested in help with a professional Magento installation, please do not hesitate to contact me.

Posted on

First Happy Customer: Free Magento Installation reviewed

So I have got my first review for my Free Magento Installation offer, I’m very proud of it and thought I’d share it with you all.

I Helped Konrad Bloor install Magento for his store East To West. The store isn’t live yet obviously because Konrad is still configuring it and setting up his inventory. Here is what he had to say about the quality and professionalism of my work:

“Ashley’s magento services were just what we were looking for – we’d attempted an install ourselves but just couldn’t make it work. We wanted to use magento but setting it up was very complex, and we’d been coming up against a brick wall again and again.

“He first highlighted something about our hosting that had become incompatible with magento. Once we fixed that with our hosting company, he very quickly gave us a working install with a sample product (testing upload capability) and an obscured admin login to provide some protection against attack. He took care to establish trust, and backed up our existing attempt at installing. We also run a blog from that hosting on the same site, and because he left everything else alone apart from magento, that was still working as I expected. We don’t run cpanel but he figured out our control panel to get everything done without being given any instructions at all.

“I couldn’t be more pleased and would recommend his magento services to anyone – he obviously knows magento very deeply. I would happily hire him again.”

Konrad’s review has been added to my services page, which you should check out if you are interested in help with a Magento install or would like to discuss any Magento related services. As of right now I still have 2 remaining Free installations, with 2 reviews pending, so if you would like to get professional Magento help, and do not mind writing a comprehensive review like Konrad’s, then please get in touch with me.