Magento not finding product images (solution)

I migrated a Magento instance from one host to another, and in the process earnt myself some free beer; everything went well, apart from some of the thumbnail images not appearing. The image URLs would look like :

/media/catalog/product/cache/1/image/5e06319eda06f020e43594a9c230972d/images/catalog/product/placeholder/image.jpg

Things tried which didn’t help :

  1. rebuilding various Magento image caches and so on (login as admin -> System -> Cache management).
  2. Check PHP’s memory limit… (512mb… shouldn’t be a problem!)
  3. Check permissions on the media directory (chown -R www-data media .. didn’t fix it)
  4. Check PHP has gd installed/enabled – yes.
  5. Disable suhosin (no change)
  6. Check PHP logs (nothing relevant)
  7. Check Apache logs (nothing relevant)
  8. Changing the product to use a different thumbnail etc image (didn’t help)

I already knew the original host didn’t have a case sensitive file system, and this was partially fixed this using mod_speling in Apache, but this obviously doesn’t help when e.g. PHP decides to read and resize an image file.

I then tried comparing the contents in media/catalog/product with what’s in the catalog_product_entity_varchar table. So, in my case :

select value from catalog_product_entity_varchar where value like '/F%' limit 1;
returned something like :

/f/i/file_4_1.jpg

And looking in the above mentioned directory, only showed a directory called F. Simple fix… :

mv F f

(Obviously check the table doesn’t make reference to images with /F in them…. Β in my case it didn’t.)

<<reload web browser; images all appear and everything works.>>

What sort of idiot created case insensitive filesystems… grr.

Still, at least people can now browse online for Kitchens …. and see the appropriate thumbnails.

Getting a kvm serial console with grub2

I’ve a few kvm guest servers, which I’ve been accessing using vnc – but this is a bit of a pain (getting port forwarding setup etc). Host and guests run Debian Squeeze with Grub2 installed/in use.

So, here’s how to do the ‘virsh console ‘ thing …

  1. Edit /etc/default/grub, specify
    GRUB_TERMINAL=console 
    GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
    GRUB_CMDLINE_LINUX_DEFAULT=""
    GRUB_CMDLINE_LINUX="text console=tty0 console=ttyS0,115200n8"
  2. Run update-grub
  3. Edit /etc/inittab and enable ttyS0 for logins.
  4. Reboot
  5. ‘virsh console servername’ on the kvm host.

The libvirt config files I have already have the appropriate bits in them –

<serial type='pty'><target port='0'/></serial>
<console type='pty'><target type='serial' port='0'/></console>

fsck -y (or fsck yes…)

Tip for the day:

Edit /etc/default/rcS on Debian/Ubuntu servers, and set FSCKFIX=yes (default of no) so next time your server runs fsck at startup, and spends hours doing it to only moan when it finds an error, and tells you to waste more time by running fsck with ‘-y’ (to fix it).

Quite why fsck even asks me to say ‘yes’ to it’s “do you want to fix…?” questions is another matter. It really annoys me – it’s not like I have enough information to make any sort of informed choice – it’s not like I know the structure that’s present on the disk, in order to say “No! You’re wrong FSCK, inode xxxxx should be blahblahblah”. I can only say ‘yes’.

If only FSCKFIX=yes was the default setting….. I can’t imagine Windows or OSX ever asking someone to answer such questions.

All in a day’s work…. (magento and putty)

Here’s a random summary of some vaguely interesting techie things today.

Magento Migration

When exporting a Magento website from a third party (e.g 1&1), you’ll need to :

  1. Copy all files across; the ‘var’ directory can probably be omitted as it’s full of cache like stuff. ‘media’ and ‘var’ look like they need to be writeable by the web server.
  2. Edit the app/etc/local.xml file to specify the new database settings
  3. Check the various .htaccess files; the one in the root directory will probably need tweaking.
  4. Dump the database, and ensure that it has the following at the top of the dump file before restoring on the new host:
  • SET NAMES “utf8”
  • SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”

Failure to do the ‘utf8’ one, will lead to Β£ symbols being slightly wrong.

Failure to do the second will ensure that all the foreign key references fail (so restoration will be hard to start with) and if you disable the foreign key checks (‘SET FOREIGN_KEY_CHECKS=0;’) you’ll find that Magento will b0rk on access – complaining about nulls and so on in parts of the configuration (the error message will likely mention app/code/core/Mage/Core/Model/Mysql4/Config.php ).

All of the above is ignoring the fact that the Magento instance I migrated was infested with some malware, and I’m not yet sure how it ‘got there’, though I shot an email over to my buddy at Bing (Bing Digital is a leading Magento agency run by my buddy of 15 years). However, when it does next get infected, which it is likely to, I will at least be able to see what’s changed thanks to git.

Putty on OSX

Well, it sort of exists; if you use ‘brew‘ – namely ‘brew install putty’ does something – but doesn’t (yet? can it?) build the GUI. However, all I needed was to convert a putty ssh keyfile (blahblah.putty.key) into an openssh variant, for which puttygen works perfectly :

  • puttygen blahblah.putty.key -O private-openssh -o test.key

Strangely there don’t seem to be any free apps on the app-store for SSH. I’m almost surprised no one hasn’t just compiled putty and put it on there for 50p or free.

The pain of bios updating (M3N78-VM / ASUS)

I’ve hopefully bought a new CPU to stick in the office server. All being well, it’ll be super quick and so on.

Looking at ASUS’s website, I made sure to choose a CPU the motherboard supports. I saw it required a BOS update, so fine… that shouldn’t be hard, right?

Think again.

  1. Downloaded BIOS file (possible from this link)
  2. Downloaded FreeDOS, burnt to CDR so I could boot into a DOS like environment.
  3. Copied BIOS file + AFUDOS update utility to USB stick.
  4. Rebooted, booted off CDR, chose to run LiveCD (No Drivers)
  5. Then tried to use AfuDos.
  6. Be good – take a backup first (afudos.exe /obiosbackup.rom
  7. Try and install a newer one (afudos.exe /iM3N78-~1.ROM) – fails with a message like “invalid bios id in rom”. Quite unhelpful.
  8. I tried various different .rom file names, but no combination of motherboard (M3N78) and bios version name seemed to work.
  9. Eventually, Googled a LOT more, and found that there is an ‘engineering’ version of the AfuDos tool, which allows you to force the update, and ignore any stupid check….
  10. For the sake of it, I tried to restore the backup I’d taken, using the original afudos.exe, but this didn’t work (WTF?)
  11. Downloaded ‘engineering’ afudos tool (try e.g. here)
  12. Ran with ‘afudos.exe /ibiosbackup.rom /n’ (the /n tells it to not do the stupid check) – worked… OK.
  13. Rebooted
  14. Entered back into DOS, and ran: ‘afudos.exe /iBiosIWantToUse.rom /n
  15. Crossed fingers, hoped I wasn’t going to brick the stupid motherboard…
  16. Success.
  17. Reboot. Carry on life.

The ‘onboard’ ez-flash utility ASUS provide seems totally useless.

Oh well, hopefully we’ll soon have 6 cores of goodness powering Jenkins.

Twitter Weekly Updates for 2011-03-13

  • Can't be bothered to give up chocolate for lent. Pancakes on the other hand will not be missed. #lent #fb #
  • Reminders:
    * @PHPWM meeting tomorrow (free beer/pizza phpwm.org);
    * It's Pie Week;
    * Pancake today tomorrow.
    Nom nom nom #Fatties #fb #
  • rah rah rah rah rah rah rah rah rah rah

    I have to walk home today πŸ™ #

  • A new week, and my bike chain breaks again. Halfords were sold out of connector links and replacement chains. I feel it's a conspiracy #fb #
  • β€œ@StormySan: Every other sentence today is 'Oh my god that's disgusting'. She's just bleached her desk and keyboard.” #fb #
  • Cw54 dmx – you tailed me on the m6 for 30miles; Learn to: dip headlights (not on full beam) & use left hand lane-it's not lorries only #fb #
  • Hmm. I shouldn't have expected any better. On the ground next to the car is an untwisted coat hanger. Car seems ok #LiverpoolAirport #fb #
  • Hello Liverpool. I'm back. Now to drive home. *yawn* happy flyings! #fb #flylo #

Twitter Weekly Updates for 2011-03-06

  • β€œ@gpjt: I always wondered what those buttons on my camera did: http://t.co/HV6rHhw” #
  • Landed: BCN. #
  • Sarcasm seems lost on Liverpudlians. #
  • Tweet tweet tweet #
  • Tweet tweet tweet #fb #
  • It's very relaxing listening to a baby sleeping on your chest. Slings rule. #
  • β€œ@chartoftheday: CHART OF THE DAY: Here's How The Xoom Stacks Up To The iPad 2 http://read.bi/eF9TGt” <- interesting. Xoom > ipad2. #
  • OMG – best cookie EVER from Catshill bakery. Meal in a cookie – Nom Nom Nom. #
  • The king of hearts called for the tarts and beat the knave full sore. #
  • http://stackoverflow.com/questions/1995113/strangest-language-feature – Javascript has some interesting features…. #
  • Who will last longer: me cycling or Jenkins building a Php project? 1.5 hours and counting. No I understand large build servers.. #
  • β€œ@StormySan: Boss just used a whois lookup to find out a friend's address. I find this awesome. #geek

Twitter Weekly Updates for 2011-02-27

  • β€œ@GeneHunt: Had a plateful of Oysters and syrup of figs…didn't know whether I was coming or going.” #
  • Thanks to the organisers for #phpuk2011 Free beer and knowledge are always appreciated. πŸ™‚ #
  • Shawn Hair eh ? #phpuk2011 you've won a prize … #
  • Web scale reminder – http://www.youtube.com/watch?v=b2F-DItXtZs – #phpuk2011 #
  • Yey. A web scale slide πŸ™‚ go go mongo. #phpuk2011 #
  • Php-jenkins.org looks like the way forward. sweet. #phpuk2011 #
  • The "myspace are firing" t-shirts are great. #phpuk2011 #
  • β€œ@bookmeme: The Microsoft guy is struggling with the word 'interoperability' #html5 #phpuk2011” <- HAHA, nice. #
  • wifi suffering – ssh connection almost unusable. boo hiss. #phpuk2011 #
  • A better hands up question might have been : #phpuk2011 or #phpuk11 πŸ™‚ #
  • β€œ@rowan_m: Woo! Made it to #stampex let's get licking. Wait… Hold on.” #phpuk2011 #
  • All those weirdos going to stampex. Bloody geeks. #phpuk2011 #
  • Right train. Right time. Onwards to #phpuk2011 #phpuk11 #
  • It's not healthy getting up this early. #
  • OH sales droid .."Tim Berners-Lee invented TCP"… #
  • I'm switching to Oxfam for my water supply seeing as they can supply a family of four for Β£2, I reckon I'll save at least Β£1k a year… #
  • Selenium RC setup; same IE6 doesn't seem to want to join in the fun. #
  • Totaljobs just emailed asking if I'm "looking to train for a career in IT" … well, that sounds a good idea now… #fail #
  • β€œ@glynmoody: TSA Source: Armed Agent Slips Past DFW Body Scanner – http://bit.ly/dSm49C chocolate teapots, anyone? (v @laserfox) #security

Compsci Industrial placement year email

Now is obviously the time students are pulling their fingers out and thinking about industrial placement years.

Obviously I’d have a bias towards a certain university if I were looking for a student,Β but ignoring that, I received an email today from someone fishing for vacancies (this is ignoring the fact I’m not advertising for one, and I’m not sure we could accommodate one if we did).

Dear PalePurple,

I am a second year student at Blah Blah University, studying Computer Science BSc. I would be delighted if you could consider my application to any web development or Linux systems development work placements you may have available.

Yours sincerely,
A. Student

Anyway, here’s my response to them, which probably says enough on it’s own, without me having to selectively publish their CV.

Hi,

For some random feedback: Your CV doesn’t really mention anything you may have done with your web development skills – aside from listing xhtml/css etc.

It’s also bare of anything you may have done with any sort of programming skill – what projects have you done inside/outside of university? You mention a group project, but gave me no idea what it involved.

Have you done anything outside of your course which shows some interest in the subject area (e.g. dabbled with Arduino devices, read about MVC/design patterns, been to an industry conference, joined a local user group, written some random program that does X in your spare time……… ).

If you are serious about web development, then you will need to mention sites you’ve created on your CV – these may just be sites of your own (i.e. they don’t have to be for real companies/entities) – all I would be interested in seeing is that you are interested in the field, have taken the time to learn about jQuery / CSS3 / HTML5 / whatever – which would put you towards the top of any potential interview shortlist and make you FAR, FAR more interesting as a potential employee!

Aside from the above, we’re not currently looking for an industrial placement student.

thanks,
David.

I have been thinking about getting an industrial placement student this year, but I’m not sure we have room in our office for a student.

Twitter Weekly Updates for 2011-02-20

  • Bromsgrove hockey 3xi vs Old Wulfs. Lost 11-2. #
  • I'll never grow up…. (thanks @carolinegoodwin) http://twitpic.com/41dg39 #
  • I'm sure that drinking one more beer will beat this cold into submission … #science #alcohol #germs #
  • Ping me on @pingchat at ID: david-goodwin – Send text, photos, videos, and other media to my phone for free! http://pingchat.com #
  • β€œ@madeupstats: 40% of foreigners are racists*.

    *Source: BNP” #

  • Yep, as predicted, Ann Summers are making the most of 'The Year of the Rabbit'. #
  • …. Answer: soft play place. #
  • Three guesses for what a "children's experience centre" is….. #
  • 0b100000 aka 0x20 aka 2^5 aka 32. #
  • β€œ@madeupstats: David Cameron isn't out of touch: A third of his closest friends are unemployed (Heirs and landowners, mostly)” #
  • Customer offered to pay me in beer. I declined, but he's still sending a case through. Result! #
  • Walking. It's so slow. #iMissMyBike #
  • The chain just snapped on my bike πŸ™ It's only ~1 month old. Decathlon–
    Luckily I was just arriving at my destination. *sigh*. #
  • β€œ@birminghampost: Worcester hospital pays compensation to parents of stillborn baby http://bit.ly/fuFEVJ " #
  • A mouse took a walk in a deep dark wood. A fox saw the mouse, and the mouse looked good….. "come and have tea in my underground house"… #