PHP + GD in CentOS 4.3

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
LVL 1
lolavarrietaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
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
ahoffmannCommented:
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
Richard QuadlingSenior Software DeveloperCommented:
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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

m1tk4Commented:
You don't need to recompile anything. Install php-gd rpm.
0
Richard QuadlingSenior Software DeveloperCommented:
If you install an rpm, you are probably going to need to enable the extension within php.ini.
0
m1tk4Commented:
>>>  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
Richard QuadlingSenior Software DeveloperCommented:
Are RPM's binary compatible with CentOS?
0
m1tk4Commented:
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
Richard QuadlingSenior Software DeveloperCommented:
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
m1tk4Commented:
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
Richard QuadlingSenior Software DeveloperCommented:
Ok. That makes sense.

0
limneosCommented:
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
m1tk4Commented:
split 50/50 m1tk4, limneos
0
Richard QuadlingSenior Software DeveloperCommented:
Agree. I don't think I contributed anything to this question.
0
ahoffmannCommented:
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
m1tk4Commented:
>>My apache and php where instaled from rpms

is the key. He did not NEED to recompile anything.
0
ahoffmannCommented:
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
m1tk4Commented:
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
ahoffmannCommented:
> You don't need to recompile to get GD if it's already done for you.
agreed (in most cases that's true)
0
VenabiliCommented:
So what we do here?
0
ahoffmannCommented:
split or PAQ with 0 points
0
Richard QuadlingSenior Software DeveloperCommented:
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
m1tk4Commented:
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
Richard QuadlingSenior Software DeveloperCommented:
PAQ w. 0 then.
0
ahoffmannCommented:
agreed
0
philjones85Commented:
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
GranModCommented:
PAQed with no points refunded (of 125)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.