I just threw an entire weekend away (and with the nicest weather we have had for sometime) sitting staring at my laptop trying to figure out why my functioning local version of Magento 188.8.131.52 refused to transfer to my remote host without breaking. It took long enough to transfer the files across (with the occasional one failing and needing to be re-submitted) – but then it took twice as long to find out why my picture zoom had broken (no matter what theme was active) and why the Add to Cart button led to a blank screen on Safari and a 500 error on most other browsers.
So another browse led me to assume that all the permissions had been messed up during the FTP transfer. Rather than attempt to change the permissions manually on thousands of files and folders, I was led to a very hand php script called magento_cleanup.php which, when run, will do exactly that – reset all the permissions to the correct format (755 for folders, 644 for files and 550 for pear scripts).
Copy the file to your main Magento directory and point your browser to it.
As satisfying as this was, it didn’t fix the problem. I resorted to Maglance, a place to post projects and recruit Magento freelancers. I thought I would put it in the hands of the experts. I got some helpful suggestions before anyone actually bid on the project, and one request was for me to:
- Turn on system and exception logging in admin: System/Advanced/Developer: Log Settings.
- Rename the file errors/local.xml.sample to local.xml
- Delete the contents of the var folder
I did this and the site completely broke. I could no longer access the front or back end, and a MYSQL 5000 error kept telling me that the site couldn’t connect to my database. This led to a flurry of comments from the freelancers suggesting (understandably) that I must had done something the database or app/etc/local.xml file – even though I had done nothing of the kind.
By this time I had spent Friday night, all of Saturday until 3am and half of Sunday (interspersed with episodes of Pride and Prejudice to calm me down) struggling with the beast. I hadn’t wanted to delete everything and start again, but actually, that’s exactly what saved me.
The following steps led me to 11.30pm on Sunday night, got the site working and gave me a peaceful night’s sleep:
- Make a backup of the (working) local site in System/Tools/Backups – and download the database backup
- Create a new MySQL database with a different name and user name than the one used before and import the backup data into it
- Edit the two fields in the core_config_data table for web/unsecure/base_url and web/secure/base_url replacing them with the new (remote) location of your new Magento directory
- Upload (!) the entire website again to a new (differently named) directory
- Once uploaded (a couple of hours later, hopefully without errors) edit the app/etc/local.xml file with the new database details
- Delete the contents of the var folder (if you uploaded it – the obvious answer here is not to upload your old local cache files)
- Gaze in wonder and relief at your working site! Zoom, Add to Cart and everything else worked again.