Ever setup a local version of a web site and it just would not work? You aren’t the only one, and you won’t be the last considering the numerous ways a site can be setup with caching and sessions, and the places where things can derail. One setup that I recently battled with delivered the following fatal error following setup:
This was a pretty simple fix once I looked at the local.xml. Session_save was set to Db instead of Files. When Session_save is set to Db on local, more than likely your storage path isn’t setup correctly and when it tries to save it doesn’t have the proper permissions to do so.
The quick fix is to just set to <session_save><![CDATA[files]]></session_save>
. By doing this you are reverting magento back to saving all sessions in the file system.
By changing db to files, I was able to load the site and proceed. Success!
Troubleshooting other Local Magento Setup Issues
This is clearly not the only issue that you can have when setting up a local Magento website. Other terrible results can include:
- The dreaded White Screen of Death
- 404 Page Not Found
- Redirecting to the dev/live site on the local environment
The first issue is probably the easiest to solve out of them all. Check your local install and make sure you have the following files setup correctly, as it’s likely they are either missing or not setup at all. (Womp womp).
- .htaccess in the root
- app/etc/local.xml check that its pointing to the correct DB
- index.php in your root
- Also, make sure you correctly setup your hosts file and your vhosts file depending on local setup of MAMP
The answer to the 404 page issue is more aggravating as it usually means I forgot to delete the cache or full_page_cache folders and my local just isn’t loading due to my own silliness.
Properly setting up hosts files and vhosts files usually comes down to these couple fixes:
- .htaccess in the root has a redirect to the live site
- the database table core_config_data, base_url is still set to either the live site or the dev site.
Good Luck.