Post Reply  Post Thread 
[HowTo] PHP5 cgi with bundled gd
Author Message
hbaes
Junior Member
*


Posts: 15
Group: Registered
Joined: Nov 2007
Status: Offline
Reputation: 0
Post: #1
[HowTo] PHP5 cgi with bundled gd

In this short HowTo I will describe how You can rebuild the php5-cgi to use the php5-bundled gd library on debian etch.

This point is sometimes necessary if you or your application will use some special gd functions missing in the libgd but be part of the php5-gd. (i.e. imagefilter() or imagerotate() will be missing if you use the original debian etch php5-cgi)

firrst of all:

PHP Code:
apt get update 

PHP Code:
apt get upgrade 


change to the source directory

PHP Code:
cd /usr/src 


download the source for php5 from debian

PHP Code:
apt-get source php5-cgi 


download some other stuff for re-building the package:

PHP Code:
apt-get build-dep php5-cgi 


after that change to the new extract of php5-5*
when i write this the current version is php5-5.2.0:

PHP Code:
cd php5-5.2.0 


now edit the debian configuration:

PHP Code:
vi debian/rules 


change every line from

PHP Code:
--with-gd=shared,... 

to

PHP Code:
--with-gd 


in the section configure-cgi-stamp: patch-stamp add the following lines: (I didi it after the $(COMMON_CONFIG) line)

Quote:
--with-jpeg-dir=shared,/usr \
--with-gd \
--enable-gd-native-ttf \


now save the rules file and start the re-building ...

PHP Code:
./debian/rules binary 

after a cuple of time change back to the source the directory
and you will see a couple of new .deb files.

PHP Code:
cd .. 


now install the new cgi binary

PHP Code:
dpkg -i php5-cgi_5.2.0-8+etch11_i386.deb 


after all restart apache ...

PHP Code:
/etc/init.d/apache2 restart 


thats all

Harald

Edit: Updated to the last Version, JPEG Support 4 GD enabled.

This post was last modified: 06-10-2008 07:33 PM by hbaes.

01-04-2008 12:03 AM
Find all posts by this user Quote this message in a reply
raphael
Member
****
Dev Team

Posts: 474
Group: Dev Team
Joined: Apr 2007
Status: Offline
Reputation: 8
Post: #2
RE: [HowTo] PHP5 cgi with bundled gd

And the benefit is...?
The php package in Debian doesn't use the bundled library because of security reasons.
When a shared library has a security bug and is fixed all the binaries using that library are 'safe'. But if the bundled library code isn't fixed php would still be vulnerable (and let me tell you something, the security team won't fix the bundled one).

This is a fix one, save them all v.s. a fix ALL, waste your time situation; of course Debian uses the former approach (others should do too, why aren't the changes in the bundled libgd2 code included by the main libgd2 library?)


YaHost Me | Text Link Ads | my Debian repository | Donate! | No OOXML! | Project HoneyPot | ... and more

Quote:
This is Linux land. In silent nights you can hear the Windows machines rebooting.

If you want to be helped, don't PM me but post in the forums | If you want private support PM me and we'll discuss the price

01-05-2008 03:58 AM
Visit this user's website Find all posts by this user Quote this message in a reply
bjflame
Junior Member
*


Posts: 13
Group: Registered
Joined: Mar 2008
Status: Offline
Reputation: 0
Post: #3
RE: [HowTo] PHP5 cgi with bundled gd

hi

thanks for this howto. i need functions like imagerotate().

but now i've got one more problem.

i did it like its explained, but the gd doesnt support jpg and png.

how can i rebuild it that this is enabled?


regards

03-26-2008 02:53 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump:

| All rights reserved : isp-control.net |