?
Solved

PHP + GD in CentOS 4.3

Posted on 2006-03-28
29
Medium Priority
?
1,721 Views
Last Modified: 2013-12-13
How can I recompile my PHP in CentOS 4.3 so it can support GD? I already instaled JPgraph and it doesnt work. My apache and php where instaled from rpms
0
Comment
Question by:lolavarrieta
  • 9
  • 8
  • 6
  • +4
27 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16318844
This is from the PHP Manual ...

Installation
To enable GD-support configure PHP --with-gd[=DIR], where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd. GD library requires libpng™ and libjpeg™ to compile.



Unfortunately, I'm a windows user so I don't need to compile anything. All done for me by those very nice people at PHP.net

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16320265
you need to build GD with following configure options:
        --with-freetype=$PREFIX
        --with-jpeg=$PREFIX
        --with-png=$PREFIX
(which requires that freetype, pegsrc and libpng are installed)

then PHP's configure options (beside others) are:
         --with-freetype-dir=$PREFIX \
         --with-jpeg-dir=$PREFIX \
         --with-tiff-dir=$PREFIX \
         --with-gd=$PREFIX \
         --with-png-dir=$PREFIX \
         --with-ttf=$PREFIX \
         --enable-gd-native-ttf \

(where $PREFIX is the path to your installation directory)
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16320497
As a windows user I'm not really sure what happens on *ix.

When you compile PHP, do you compile in all the extensions into 1 big exe?

Or do you compile each extension separately? Allowing for easier amendments?

If so, does the extensions= settings in php.ini have any effect?

If you've compiled it in, it is available!

Wouldn't compiling each extension separately be a better option? That way, they can be loaded on demand?

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 15

Expert Comment

by:m1tk4
ID: 16458847
You don't need to recompile anything. Install php-gd rpm.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16475658
If you install an rpm, you are probably going to need to enable the extension within php.ini.
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16477204
>>>  If you install an rpm, you are probably going to need to enable the extension within php.ini.

No you don't. RPM does it for you, you only have to restart Apache.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16477314
Are RPM's binary compatible with CentOS?
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16477589
The RPM I am talking about is part of the distribution, it should be on your CD's or available through yum install. Pretty much everything in CentOS is RPM-based, so this is like asking if I am biologically compatible with my own arms and legs ;)))
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16477958
Hey! You may be a transplantee! In which case the possibility of rejection is always present!

But the CD would only contain an old version.

If you want to get the LATEST version (i.e. from source), then you would normally need to compile it as binaries are only held for Windows. Though with the new and free Microsoft C++ 2005 Express Edition, this may all change!

0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16478006
Trust me, you DON'T want the latest version if a regression-tested and patched version is available in your distribution. Been there, done that.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16478118
Ok. That makes sense.

0
 
LVL 1

Expert Comment

by:limneos
ID: 16533513
even YUM could do this for you, provided that your repos include php-gd

try typing at the shell prompt:

yum install php-gd
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16705110
split 50/50 m1tk4, limneos
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16706735
Agree. I don't think I contributed anything to this question.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16707194
hmm, the question was:
> How can I recompile ...
yum and rpm are not usefull to recompile anything (except you use a source package which has *not* been suggested), so I disagree with the suggested split and belieave in my suggestion
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16708028
>>My apache and php where instaled from rpms

is the key. He did not NEED to recompile anything.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16711270
hmm, we get into a philosophic discussion ..
I refer to a question (that's what EE is for) while you refer to a statement. We don't need solutions for what is already done.
0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16712253
I refer to a particular situation he is in (stock PHP RPMs installed), in which the best and easiest way to solve his problem (missing GD) is to install stock php-gd RPM, and not to recompile PHP from the scratch. As you say yourself,

>>We don't need solutions for what is already done.

You don't need to recompile to get GD if it's already done for you.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16712698
> You don't need to recompile to get GD if it's already done for you.
agreed (in most cases that's true)
0
 
LVL 20

Expert Comment

by:Venabili
ID: 16736122
So what we do here?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16736675
split or PAQ with 0 points
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16742942
The answer is either recompile along the lines of the PHP manual

OR

install the appropriate pre-compiled libraries and activate them.


Both are valid ways of acheiving the goal IF the goal is only to get the library activated.

But, if the goal was to learn how to compile PHP and to enable GD EVEN THOUGH the library is available pre-compiled (the fact that precompiled modules were previously used is just info), then I think (oddly enough), my comments are the only valid answer.

m1tk4, "You don't need to recompile to get GD if it's already done for you.".

Absolutely true, but without a clearer indication from the questioner as to his primary goal (compiling OR installing GD), I think it has become a 3 way split. But maybe I don't deserve any for being greedy! I would hope that I do though.

0
 
LVL 15

Expert Comment

by:m1tk4
ID: 16746143
125 point puhleeze - we are discussing this in 10 messages already?!?! I suppose if we are all that smart to be experts we are all probably gainfully employed and have better (and more important things to do than discuss who was right and who wasn't and why? PAQ w. 0 and move on.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16749053
PAQ w. 0 then.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16749116
agreed
0
 
LVL 6

Expert Comment

by:philjones85
ID: 16841675
actually, i object to PAQ with 0.  i'm in the exact same situation as the original poster and didn't know the php-gd rpm was available through yum in centOS.  i don't know who should get points, b/c i don't know what the author was thinking either, but the suggestion to just load the php-gd package solved the problem, even if the solution wasn't done through the way the author asked for it.

for all i care, you can reduce the points to 0, but at least mark it as solved for anybody that happens upon it in the future.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16868755
PAQed with no points refunded (of 125)

GranMod
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question