Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to add GD support to PHP when compiling it...
#1

ok i've just recompiled apache/mysql/php

 

and while recompiling php i wanted to add GD support

 

to add GD support for png and jpeg i used the following configure switches for php, making sure to first

 



Code:
yum install libpng and libjpeg




 

don't forget to make clean as below (it resolved my problem from multiple compiles)

 



Code:
make clean

./configure \--with-apxs=/usr/local/apache/bin/apxs \--with-mysql=/usr/local/mysql \--with-gd \--with-jpeg-dir \--with-png-dir

make

make install




 

the configuration flags \--with-gd \--with-jpeg-dir=/usr \--with-png-dir=/usr add our GD support for Zenphoto (image gallery software, example here)

 

for troubleshooting php errors make sure to log them to your apache error_log

 

to do that, edit your php.ini file

 

vi /usr/local/lib/php.ini

 

find

 

Quote:; Log errors into a log file (server-specific log, stderr, or error_log (below)); As stated above, you're strongly advised to use error logging in place of

; error displaying on production web sites.

log_errors = Off
 

change to

 

Quote:; Log errors into a log file (server-specific log, stderr, or error_log (below)); As stated above, you're strongly advised to use error logging in place of

; error displaying on production web sites.

log_errors = on
 

restart apache and the php errors such as this will give you an idea of what is wrong in the first place

 

Quote:[Tue Mar 4 17:43:43 2008] [error] PHP Fatal error: Call to undefined function imagecreatefromjpeg() in /usr/local/apache/websites/niallbrady/photos/zp-core/functions-image.php on line 59
Reply
#2

i'm not sure if this is the answer to my question, but seems like not..

what i want is to add gd-library into my existing php5.. so how can i add gd-library only into my existing php5?

 

thanks

Reply
#3

Quote:i'm not sure if this is the answer to my question, but seems like not.. what i want is to add gd-library into my existing php5.. so how can i add gd-library only into my existing php5?

 

thanks
 

Are you using packages from your distribution (if so, which distribution), or did you download and install from source?

Reply
#4

Quote:Are you using packages from your distribution (if so, which distribution), or did you download and install from source?
 

Not from source, it comes from CentOS 5. any idea how can i add php-xml php-pear php-imap php-gd modules to the existing php5?

Reply
#5

Quote:<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentcommentid="12341" data-ipsquote-username="hybrid" data-cite="hybrid" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="3395" data-ipsquote-contentclass="forums_Topic"><div>Are you using packages from your distribution (if so, which distribution), or did you download and install from source?
 

Not from source, it comes from CentOS 5. any idea how can i add php-xml php-pear php-imap php-gd modules to the existing php5?



</div></blockquote>
 

That should be as simple as running:

 



Code:
yum -y install php-xml php-pear php-imap php-gd




 

as root. Yum will restart Apache when the install is complete and those features should then become available.

Reply
#6

oh great, thanks.

 

EDIT: seems like not working though, phpfinfo says - '--without-gd'

 

even after restarting apache. installing it from yum seems ok, but phpinfo still says --without-gd

Reply
#7

Regardless of the --without-gd, is there a gd section in phpinfo?

 

Open up phpinfo, hit Ctrl-F and type gd to find it if it is there. It should look something like this:

 

[Image: 20080625-kthkteju7anwbjurdx91bjiupu.preview.jpg]

Reply
#8
i see. there is actually. thanks mate!
Reply
#9

Quote:i see. there is actually. thanks mate!
 

Yeah, I guessed that would happen. For future reference, the reason behind that is installing through packages works differently than putting GD support in at compile time, in that the configure string won't change.

 

Glad it should be all working now.

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)