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

Free Magento Hosting Competition

Yes that’s right, I am offering two 12 month shared hosting plans as prizes for a Free Magento Hosting Competition – no strings attached, totally free. Why? Well, constantly doing Magento installations for other people gives me a great deal of insight into the operations of hosting companies. I thought it was time I started sharing those insights by doing a series of reviews for web-host companies that offer Magento hosting.

I reached out to several prominent host companies asking for a trial access period to test installations for my hosting reviews. Not only have the handful of initial companies been very helpful and co-operative, two of them have actually gone one step further and offered a prize for my readers!

Just to give those two companies a quick and well deserved shout-out for their generosity, a big thank you to A2 Hosting and Nexcess Hosting. To sweeten the deal even more I have decided to also offer free Magento installations to the winners of those two 12 month packages. So you’ll not only get a free year of Magento hosting, you’ll get a professional Magento installation done for free too!

I haven’t started writing up the Magento installation hosting reviews yet, but they will be trickling in over the next week to 10 days. I just thought I’d let you all know I have the hosting prizes available and will be starting to accept entries to the competition. What’s the competition, you ask?

I’m going to compile a list of top do’s and dont’s for hosting companies, based on my readers experiences. So I want you to tell me about your positive and/or negative experiences with web hosting companies. I’ll compile them and create the lists. All entries will go in the draw to win one of the two 12 month hosting packages. If your entry makes me laugh, I’ll make it a blog post, so be funny and get a free link!

So please go to my competition page and enter the draw, I’m really looking forward to hearing about other people’s experiences with web hosting. I bet you are looking forward to a chance to win some super sweet prizes.

If you are a Magento hosting company interested in being reviewed, please contact me to make arrangements.

Posted on

How to Bulk Enable Products when Google Checkout is Disabled in Magento

Magento allows you to disable Google checkout functionality for each product. Under certain situations though (when upgrading from 1.2 to 1.3 for example), the state of your products eligibility for sale through Google Checkout changes.

If you find yourself unable to sell products through Google checkout you can easily enable Google Checkout for your products through the Magento admin interface. However if you have many hundreds or thousands of products going through each one is not an option.

Here is a solution that will allow you to set the state of all your products to enabled for Google Checkout, quickly and easily. Testing has been limited to my own development installation, so as always backup your data before running anything.

Continue reading How to Bulk Enable Products when Google Checkout is Disabled in Magento

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!