This is perhaps the most geeky blog post I’ve done yet. Basically, I ran into a problem this morning. A couple of weeks ago I installed Ubuntu on a virtual server to replace the aging physical server running SuSE 7.3 that powers the intranet pages at work. Everything was fine, until today…
I also use the install of PHP on that server to create thumbnail images as part of a photo gallery creation system I have for work’s website. As part of the code, it uses the function “imagecreatefromjpeg()”, which isn’t a standard PHP function but part of PHP’s GD extension. Without that extension, I was getting an error – “Call to undefined function: imagecreatefromjpeg()”. So, I tried installing GD:
sudo apt-get install php5-gd
And a restart of apache2:
sudo apache2ctl -k stop
sudo apache2ctl -k start
And… nothing. I was still getting the “Call to undefined function: imagecreatefromjpeg()” error. Having searched around on the internet, it seemed the thing I needed was to recompile PHP5 with the option –with-jpeg-dir=<path to jpeg libs>. Thing is, I didn’t really want to recompile.
Luckily, apt-get lets you reconfigure existing packages with additional options. So, with this command:
sudo apt-get install php5 –reinstall -o=–with-jpeg-dir=/user/lib
and another restart of apache2, all was well again and my script ran fine. Hurrah!