Monday, June 18, 2012

PHP GD Bundled - Compilation Instructions for Ubuntu 12.04

I needed to recompile the gd in ubuntu 12.04 to work with gd bundled version Warning i don't use mysql but only firebird so your requirements may vary
  1. Open up a terminal.
  2. Become root by typing su and enter your root password when prompted.
  3. Download some packages we'll need for the install. Type apt-get install build-essential debhelper fakeroot dpkg-dev firebird2.5-dev 
  4. Change your current directory to your source one. cd /usr/src.
  5. Download the PHP 5 source code by typing apt-get source php5.
  6. We also need the PHP 5 dependencies. To download these, enter apt-get build-dep php5.
  7. Go into the downloaded PHP directory. cd php5-XXXX. just press after you've typed php5- to complete the folder name.
  8. Now we need to edit a config file to change it into the bundled version of GD. Type  editor debian/rules. (I have removed any reference to mysql in the cofigure lines )
  9. Locate the line that says --with-gd=shared,/usr --enable-gd-native-ttf \ and change it to --with-gd=shared --enable-gd-native-ttf \ by removing ,/usr. (Press ctrl+w to find something, if you search for gd, it is near the second occurrence). To save the file, we need to press ctrl+x then press y and then enter.
  10. Now we've done setting up we now need to compile it. Type dpkg-buildpackage -rfakeroot -d
  11. When it's done, you should have a load of .deb files in the parent directory. Find the one starting with php5-gd.
  12. Install it by double clicking on it, or from the terminal, type dpkg -i php5-gdXXXXXXX just press after you've typed php5-gd to complete the file name.

5 comments:

GothBoy said...

Mersi! M-a scos dintr-o dilema :)

In afara faptului ca a durat vreo 2 ore compilarea, totul a mers bine.

Easy said...

If you're running Ubuntu with AppArmor installed, building may fail with mysql permission errors (13). Even if directory permissions for the mysql_db are 777.

In that case, disable AppArmor and restart the build process as follows:

# /etc/init.d/apparmor stop
# /etc/init.d/apparmor teardown
# dpkg-buildpackage -rfakeroot -nc

Marco Mannessen said...

i get this message

dpkg-buildpackage -rfakeroot -d
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro
dpkg-buildpackage: source package php5
dpkg-buildpackage: source version 5.3.10-1ubuntu3.8
dpkg-buildpackage: source changed by Marc Deslauriers
dpkg-buildpackage: host architecture amd64
dpkg-source --before-build php5-5.3.10
fakeroot debian/rules clean
dh_testdir
sed -i -e 's/EXTRA_VERSION="-1ubuntu3.8"/EXTRA_VERSION=""/' configure.in
rm -f prepared-stamp
QUILT_PATCHES=debian/patches \
quilt --quiltrc /dev/null pop -a -R || test $? = 2
No patch removed
rm -rf .pc debian/stamp-patched
dh_testdir
dh_testroot
QUILT_PATCHES=debian/patches \
quilt --quiltrc /dev/null delete debian/patches/suhosin.patch \
|| return 0
Patch debian/patches/suhosin.patch is not in series
/bin/sh: line 2: return: can only `return' from a function or sourced script
make: *** [clean] Error 1
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2

Unknown said...

Thanks for stealing my work. The original is at maxiwebs.co.uk/gd-bundled
If you're going to steal, at least give the person you stole it from some credit

petemaxi - maxiwebs

Popa Adrian Marius said...

It was mostly for myself , with fewer steps that in your case

but if you want i can delete the post

also please add a license to the page