0

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

;extension=php_gd.dll

Searched for something with php_gd and found

/usr/include/php5/ext/gd/php_gd.h

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

extension=php_gd.h

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' -
/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/php_gd.h:
invalid ELF header in Unknown on line 0
Kenny Rasschaert
  • 9,045
  • 3
  • 42
  • 58
Luca Borrione
  • 755
  • 2
  • 9
  • 16

2 Answers2

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:

extension=gd.so

and it should work.

Sacx
  • 2,581
  • 16
  • 13
  • 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? – Luca Borrione Jan 24 '12 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 http://serverfault.com/questions/352771/how-to-install-different-versions-of-memcache-with-different-versions-of-lampp another post of mine when I faced the same problem for memcache – Luca Borrione Jan 24 '12 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? – Luca Borrione Jan 24 '12 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 – Luca Borrione Jan 24 '12 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 '12 at 15:38
  • The result is:-rwxr-xr-x 1 root root 103800 2011-12-13 20:00 /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/gd.so .. anyway in the meanwhile I ran a phpinfo and noticed that gd comes already enabled with any version of lampp .. :) .. is there a way I can test everything is working right with it? Anyway the issue with memcache still remains – Luca Borrione Jan 24 '12 at 16:03
  • Maybe it's better to close this question, because it's related to gd .. how could it be done? – Luca Borrione Jan 24 '12 at 16:12
  • That probably means is builtin. delete the extension ( rm /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/gd.so ). Get this file from here http://www.dagondesign.com/files/gd-test.txt, rename it as php (gd-test.php) and see if is working on your server. What problem do you have with memcache ? – Sacx Jan 24 '12 at 17:21
  • Everything done. Your test gives everything supported but T1Lib, XPM and JIS-mapped Japanese Font .. thank you! With memcache I've the same problem I thought to have with gd: how to install old php estensions with old versions of lampp .. please see this other question of mine presenting this problem .. maybe it's better if you answer me there, if you have any answer http://serverfault.com/questions/352771/how-to-install-different-versions-of-memcache-with-different-versions-of-lampp – Luca Borrione Jan 24 '12 at 17:39
  • I'm glad is working. I will take a look on that question asap. – Sacx Jan 24 '12 at 17:40
2

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.

Mughil
  • 1,929
  • 1
  • 19
  • 28