Page 1 of 1

Load GD at runtime

Posted: Mon May 17, 2004 6:52 pm
by pickle
Hi All,

I would like to use the GD library with my PHP installation, but I'm not sure quite how to do it. I'm not confident in my abilities enough to re-compile PHP, so I was wondering if there was another way I could get access to the GD libraries. Would it be an edit in the php.ini file perhaps? Thanks.

FYI: I do have the gd.so file in my extensions directory.

Posted: Mon May 17, 2004 7:28 pm
by dull1554
there should be a line in the php.ini thats like

Code: Select all

;LoadModule gd2.dll;
remove the ";" it comments it out and restart apache

Posted: Tue May 18, 2004 9:42 am
by pickle
I'm on a Linux box.

Posted: Tue May 18, 2004 2:47 pm
by dull1554
ewwwww

sorry*frowns*
though i do indeed feel that linux is better for a dedicated web server, i just run apache and php and mysql on my local machine for a local test server....sorry hope someone else can help

Posted: Tue May 18, 2004 3:38 pm
by pickle
Actually, I figured it out. There is a PHP command, [php_man]dl()[/php_man], to dynamically load PHP extensions at run-time. There are, of course, some fine details that need to be worked out, but here's the code I used:

Code: Select all

//load GD extension
  if(!extension_loaded('gd'))
  {
    dl('gd.so');
  }
Thanks for your help anyway.