Load GD at runtime

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Load GD at runtime

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'm on a Linux box.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply