I'm running lampp 1.7.1 on lubuntu oneiric.
I need to add extension for php_gd.

I installed php5-gd by

sudo apt-get install php5-gd

Had a look at php.ini and noticed the line


Searched for something with php_gd and found


Tried to copy it to

sudo cp -av '/usr/include/php5/ext/gd/php_gd.h' '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/php_gd.h'
sudo chmod 755 '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/php_gd.h'

Added to php.ini


Restarted lampp and got this error:

PHP Warning:  PHP Startup: Unable to load dynamic library
'/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/php_gd.h' -
invalid ELF header in Unknown on line 0

2 Answers 2


Why you are trying to install xampp/lampp if you already have everything on your Ubuntu repository ?

Anyway to answer to your problem, you are trying to load a header file as a module. :) It will not work.

For your lampp probably you should copy /usr/lib/php5/20090626/gd.so to /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/, but I don't know if the lampp php is compatible with Ubuntu php. Just try it.

For configuration just use:


and it should work.

  • Because we have different projects developed and running on differente environments .. that means project A developed under Apache 2.2.11 with MySQL 5.1.33 and PHP 5.2.9 while project B developed under Apache 2.2.21 with MySQL 5.5.16 and PHP 5.3.8 and so on .. I'm a developer so when they ask me to modify something I need to recreate quickly the correct environment for the project to modify. If they ask me to modify project A I will install lampp 1.7.1 for example while I need to install lampp 1.7.7 to modify project B and so on. How could I install old versions using the repository otherwise? Jan 24, 2012 at 13:27
  • Anyway, thank you for your tip! I havent' noticed gd.so I was searching somethig starting with php like php_gd :( shame on me for trying to use a header as a module (I'm still a beginner in linux and not a tech .. so I'm confused sometimes). I will try anyway but I think I won't be able to use it because they are build for different versions see serverfault.com/questions/352771/… another post of mine when I faced the same problem for memcache Jan 24, 2012 at 13:38
  • I cannot use something compiled with module API=20090626 in php compiled with module API=20060613 Best would be to have old modules of memcache.so or gd.so compiled with module API=20060613 I guess .. but how? Jan 24, 2012 at 13:38
  • Tried and got this error: PHP Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/gd.so: undefined symbol: gdImageGifCtx in Unknown on line 0 Jan 24, 2012 at 13:41
  • yes. that means your lampp php is nopt compatible with gd from ubuntu. give me the output of /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/. Run this command: ls -l /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/*gd* and post here the result
    – Sacx
    Jan 24, 2012 at 15:38

You can try it by installing the lamp development package instead of php-gd

Use the link to check out for downloading the lamp development package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .