Recompile PHP with bundled GD support

Asked by Carlos Kosloff on 2010-04-17

I have installed a LAMP server in Mint Helena Gnome 64-bit.
This is basically an Ubuntu Karmic clone, so I have an Ubuntu server.
From phpinfo():
PHP Version 5.2.10-2ubuntu6.4
System Linux HelenaGNOME 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 x86_64
I downloaded the source code and decompressed in /home/"username"/tmp.
CD to directory php5.2.10 and typed ./configure --help.
Got a bunch of options which tells me that I am in the right directory.
I need to reconfigure PHP with bundled GD support.
What is the correct syntax to do this?

Inside /home/"username"/tmp/php5.2.10
./configure --with-gd=shared --enable-gd-native-ttf \
dpkg-buildpackage -rfakeroot
dpkg -i php5-gd 5.2.10-2ubuntu6.4.deb
/etc/init.d/apache2 restart

Please modify as needed.
Thanks in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu php5 Edit question
Assignee:
No assignee Edit question
Last query:
2010-04-19
Last reply:
2010-04-20
subliminalfix (subliminalfix) said : #1

tried 'apt-get moo'

sorry couldn't help

Carlos Kosloff (ckosloff) said : #2

The reason why I need to recompile PHP is that Ubuntu/Debian compiles it with the library released by gd.org, and not with the bundled version in PHP, which has many more functions, which I need in order to manipulate images.
I moved downloaded PHP to /usr/src/php-5.2.10
Here are the options the help file for configure gives me:
--with-gd[=DIR] Include GD support. DIR is the GD library base
                          install directory [BUNDLED]
  --with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix
  --with-png-dir[=DIR] GD: Set the path to libpng install prefix
  --with-zlib-dir[=DIR] GD: Set the path to libz install prefix
  --with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix
  --with-ttf[=DIR] GD: Include FreeType 1.x support
  --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
  --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required
  --enable-gd-native-ttf GD: Enable TrueType string function
  --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support

The steps after the ./configure [options] are:
make
make install
make clean

The path to the bundled version of gd is now /usr/src/php-5.2.10/ext/gd/libgd
So, I need help on how to configure this.
The related rule for this directive says:
220 --with-gd=shared,/usr --enable-gd-native-ttf \
Have tried several options from the php-5.2.10 directory:
./configure --with-gd=shared,/usr/src/php-5.2.10/ext/gd/libgd --enable-gd-native-ttf \
./configure --with-gd=shared,/usr --enable-gd-native-ttf \
./configure --with-gd=shared --enable-gd-native-ttf \
./configure --with-gd=shared,/usr/bin --enable-gd-native-ttf \
I always get the same error:
configure: error: xml2-config not found. Please check your libxml2 installation.
ckosloff@HelenaGNOME /usr/src/php-5.2.10 $ make
make: *** No targets specified and no makefile found. Stop.
Now, libxml2 is installed, I checked in package manager.
Please help with syntax or procedure for this ./configure command.
Should I file a bug?

subliminalfix (subliminalfix) said : #3

ok dont know if this is sensible as it seems like youve done a great deal more than i would have been able to

on the -config not found can you change to that path or directory such as cd/~ .config
 and start your root folder"prompt line(input)" from there instead of running the command from usr/

what im asking i guess is it not recognizing what your uploading because of the directory/path

sorry if this doesnt help hoe you dont give up just yet!!!

Carlos Kosloff (ckosloff) said : #4

Look at the error message above: check libxml2 installation.
Installed all instances of that in package manager.
Then for another error about libpng, same procedure.
Finally I was able to compile with native gd.
Then make, make test, make install, make clean.
BUT...Drupal still complains about wrong version of GD installed.
This is definitely a bug, and I am going to file it like so.
My work-around is to use ImageMagick instead of GD.

subliminalfix (subliminalfix) said : #5

im really not that good at it perhaps

 git would help or

even the fakeroot program

the only other thing i could suggest is to go to your synaptic and hit the document section and read up in the terminal for what may be a rule exeption

i.e./ ex.. man xmodmap
 is what ive been using to try to get my mouse to operate with my left hand which is reallly annoying to some of us who cannot function in our normal enviroment since the upgrade to 9.10

sorry your still having trouble with it carlos

Carlos Kosloff (ckosloff) said : #6

Thanks for your efforts, but I would pray you to stop trying since an answer is requested every time.
I have tried the fakeroot program.
Package manager got me to the point of compiling without errors.
However, as I mentioned before, I am still getting warnings in Drupal about the wrong gd library installed.
I think it is because I downloaded the PHP version from the Ubuntu website, and it has the "lite" gd library.
I think that this problem is solved in PHP5.3.x, at least that is what I read in their site.
So I'll just wait for future releases, file the bug, and use Imagemagick in the meantime.
Thanks again.

Can you help with this problem?

Provide an answer of your own, or ask Carlos Kosloff for more information if necessary.

To post a message you must log in.