Comments on Recompiling PHP5 With Bundled Support For GD On Ubuntu
Recompiling PHP5 With Bundled Support For GD On Ubuntu You'll learn how to recompile PHP5 with bundled support for GD on Ubuntu to use advanced GD functions for image editing, like desaturation, and so on.
17 Comment(s)
Comments
In case of dependency problems, apt-get -f install should sort things out.
Hi,
this tutorial works fine. But how can i hold the php5-gd library? Every time when i run apt-get update / apt-get upgrade my system wants to override the new compiled one. Any ideas?
Thank you
Yes, I am experiencing the same issue. I am using Turnkey Linux, and the default cron jobs run apt and revert to the original php-gd with separate ubuntu compiled library.
I have been looking through the cron files to see what I can comment out! Any advice or direction much appreciated.
Thanks,
G
Thank you from Ukraine!
Edit /etc/apt/apt.conf.d/50unattended-upgrades to modify the Unattended-Upgrade::Package-Blacklist section to include the packages you do not want automatically upgraded.
Example:
// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
"php5";
"php5-gd";
"libapache2-mod-php5";
};
I have just completed this on a fully up to date Ubuntu 8.04 LTS server. Excellent post, works really well!
Two minor changes were needed because it had a slightly later version of PHP installed.
- The directory name is now php5-5.2.4
- The compiled package name is now php5-gd_5.2.4-2ubuntu5.9_i386.deb
Worked perfectly, thanks!
A few notes to anyone else that comes across this. You can use sudo instead of -rfakeroot just fine (it gave me problems), and expect the packages to take a LOOONG time to build - took me upwards of 40 minutes, I could be off there, wasnt timing.
Once done, youll have a bunch of deb files, most of which you wont need, but the install of the new gd package will take seconds, and youre done.
Test it before and after by trying to use imagerotate()
You are a star..thanks a lot...those with AMD64 servers, I have the deb which I think you can install that I have compiled. Contact me so that I can send you the deb.
You will need to "cd .." before you execute "dpkg-buildpackage -rfakeroot" you will get an error otherwise.
Hi, thanks for this great post. I followed the instructions as described however when it came to installing the compiled package, it could not be located. It might be because I am using the latest version of ubuntu and do not know the correct name for the package. I also went ahead to list the available packages but did not see any under a similar naming style to the one that you have in your post.
Any pointers in the right direction would be appreciated.
Thanks
sudo dpkg-buildpackage -d
This worked for me. It took 1 hour to compile. It made several files including:
php5-gd_5.3.10-1ubuntu3.8_i386.deb
Followed the rest of the instructions fine. Now have bundled and imagerotate() and imagettftext()
You can check for this with function_exists('imagerotate') and function_exists('imagettftext') in php.
Hey everyone,
I thought I would make this much simpler for people and provide my .deb that I created using this method. Since it takes 1 1/2 hours to get configured and it’s just easier to grab the .deb and go.
Ubuntu version 10.04 (64-bit)
http://2shared.com/file/R0PqWXeC/php5-gd_532_1ubuntu42_amd64.html
Please note that it’s the 64-bit version, so if you are on a 32 bit system it wouldn’t work. We also tested in our office with 9.04, 9.10, 10.04, and 10.10 (beta)
Now, you install this and it works perfectly, but your update manager will tell you that there’s an update. DO NOT install the update it will revert the changes. How do you get the updater to hold the package? By following the steps:
HOW TO GET THE PACKAGE UPDATER TO NOT UPDATE THIS:
1.) Open a terminal
2.) Run the following command: sudo apt-get install wajig
3.) Say Yes to the install
4.) After install do the following: sudo wajig hold php5-gd
There you go now you will have GD bundled 2.0.34, and the package updater will hold the package so it's never updated again.
Take care,
Chad R. Smith
I tried a recompile after forgetting to change the class on a 64-bit ubuntu 9.10 for php5.2 on virtualbox with this manual and the process choked on a call trace ending in child_rip+0x0/0x20
I ran make clean from within the source directory to clean up before recompile but it complained that There is no rule to target 'clean' it.
Is it necessary to symlink to the correct libraries for jpeg like described at http://php.net/manual/en/image.installation.php by Larry Kluger? They seem to be in place already. If so, how do I go about things in light of the above tutorial.
Also @Chad, thanks for the precompile but unfortunately the link is buggered. Do you have a correct address?
I figure that i'm missing some very obvious requirements that are not mentioned in this tutorial.I welcom suggestions.
Hi, I noticed the 64-bit .deb and thank you for that, but what I really needed was a 32-bit .deb, couldn't find one, so I made my own.
Here's the link:-
If you've been struggling to follow the link, it's because the URL has a space at the end for some reason. Get rid of the offending space and your page should load. Hopefully someone on this site can edit this mistake in my previous post and get rid of this one. http://www.maxiwebs.co.uk/gd-bundled/
I have updated http://www.maxiwebs.co.uk/gd-bundled/ . It now has 32 and 64 bit versions of the bundled gd library for three different versions of php, the latest php versions for Ubuntu 9.10, 10.04 and 10.10.
Compiling is such a faff, so I've done it for you, enjoy!
Hi,
I got an error on Ubuntu/Hardy by using the method above.
cat /usr/src/php5-5.2.4/test-results.txt
Warning: putenv(): Safe Mode warning: Cannot set environment variable 'SSH_CLIENT' - it's not in the allowed list in /usr/src/php5-5.2.4/run-tests.php on line 70
Warning: putenv(): Safe Mode warning: Cannot set environment variable 'SSH_AUTH_SOCK' - it's not in the allowed list in /usr/src/php5-5.2.4/run-tests.php on line 71
Warning: putenv(): Safe Mode warning: Cannot set environment variable 'SSH_TTY' - it's not in the allowed list in /usr/src/php5-5.2.4/run-tests.php on line 72
Warning: putenv(): Safe Mode warning: Cannot set environment variable 'SSH_CONNECTION' - it's not in the allowed list in /usr/src/php5-5.2.4/run-tests.php on line 73
Warning: set_time_limit(): Cannot set time limit in safe mode in /usr/src/php5-5.2.4/run-tests.php on line 76
+-----------------------------------------------------------+
| ! WARNING ! |
| You are running the test-suite with "safe_mode" ENABLED ! |
| |
| Chances are high that no test will work at all, |
| depending on how you configured "safe_mode" ! |
+-----------------------------------------------------------+
ERROR: invalid PHP executable specified by TEST_PHP_EXECUTABLE = ./apache2-build/sapi/cli/php
So I solved it this way:
I've downloaded the newest PHP5 Version: 5.2.17 (because I got an error on 5.3.6) to /usr/src/
tar -xzvf filename
cd /usr/src/php-5.2.17
./configure --with-apxs2=/usr/bin/apxs2 --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-pgsql=/usr --with-tidy=/usr --with-curl=/usr/bin --with-curlwrappers --with-openssl-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-pdo-pgsql=/usr --with-pdo-mysql=/usr --with-xsl=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-calendar --with-bz2=/usr --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --enable-zip --with-pear
(you can add soap or openssl if you want to or other modules)
make
make -i install
cd /etc/apache2/mods-available/
make sure that "php5.load" look similar like this:
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
make sure that "php5.conf" look like this:
cat php5.conf
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
if not, enable php5 module by using this command:
a2enmod php5
restart apache:
/etc/init.d/apache2 restart
then check the phpinfo()
I hope I could help some people out there.
cheers,
Phurx