Graphics---pain in the a** to configure

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
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Graphics---pain in the a** to configure

Post by wowiz »

Hello there....
I have the following set-up:
-Apache(1.3) as module
-PHP 4.3.2
-Win98

I've downloaded and installed the gd,libpng in root directory where php is installed (c:\php, each library in its own folder). zlib is in my php version already.

In php.ini, other than:
-- uncommenting the: extension=php_gd2.dll and
-- extension_dir=".;c:\php\extensions"
what else is there to configure?????
Maybe copy some ****.c files out of those libraries somewhere?????

I assume this code:

Code: Select all

<?php
var_dump(gd_info());
?>
should work once the gd is correctly installed....

Now my browser's output is:
Fatal error: Call to undefined function: gd_info() in c:\folds\php_folds\gd.php on line 2
Heeeeeeelp!!!!!!!
Judas
Forum Commoner
Posts: 67
Joined: Tue Jun 10, 2003 3:34 pm
Location: Netherlands

Post by Judas »

donono but isn't that the lib must be instaled in the extension dir rather than the php root dir
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

found this comment in the PHP Manual
this function, as well as other functions that rely on the gd library, generates an error when you don't have the extension configured in your php.ini file. I had some trouble finding out how to get it working so here are the steps I took on a clean (windows / apache)- install:

* In addition to the (windows binary) installer, I downloaded the zip package which has a lot of things the installer hasn't. I unpacked the extensions directory in my own c:\php\extensions dir.

* I changed some lines in php.ini:
+ find the extension_dir setting and set it to
c:/PHP/extensions (or your own path of course)
+ found the ;extension=php_gd.dll
line and removed the semicolon

* I restarted apache and it worked

Hope this helps you all out or at least gives you a valuable hint to get it working,
Mark
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

i tries running

Code: Select all

<?php 
var_dump(gd_info()); 
?>
and i got the same error as you, but when i do

Code: Select all

<?

phpinfo();

?>
and scroll down to the GD section, it says everything is installed. And when i test a script that generates an image, it works perfectly

Mark
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

try running this script and see if you can see the image

Code: Select all

<?php
header ("Content-type: image/png");
$im = @imagecreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 1, 5, 5,  "Test image", $text_color);
imagepng ($im);
imagedestroy ($im);
?>
Mark
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Post by wowiz »

Thanks for the replies guys!!!!

Bech100:
Your image-code did not work.....and when i run the phpinfo() function i do not see any gd section.....
What's your php version?

I did install the php-4.3.2-win32.zip binary package.....i did not run the installer binary.......
--In my c:\php\extensions i have the php_gd2.dll file
--I have the line ";extension=php_gd2.dll" uncommented in php.ini
--I set in php.ini also: "extension_dir=".;c:\php\extensions"

Any ideas?????????????
8O
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Post by wowiz »

also those libraries i've downloaded (gd, libpng.... zip packages) have no dll files in them.....
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

So you got the linux version? GD comes bundled with GD in the windows version...
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Post by wowiz »

linux version??????????
From http://www.php.net/downloads.php under "Windows Binaries" are 2 packages....installer and zip package......Ain't these for windows?????
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Post by wowiz »

:oops:
ups.....you meant the gd and libpng zips.....
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Re: Graphics---pain in the a** to configure

Post by Heavy »

wowiz wrote: each library in its own folder
Shouldn't all extension files reside in the extensions subfolder?
Can't test it myself, but it sounds strange when you set:

extension_dir=".;c:\php\extensions"

and have your extensions in fodlers like:

c:\php\whateverfolder

Did I get it all wrong?
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

Post by wowiz »

ok....but does anybody know why i have no gd section in the output of the phpinfo() function? I have php_gd2.dll in c:\php\extensions and also the php.ini settings i mentioned above...

also.....if those settings about are not enough, where should i get from the gd and libpng libraries for windows (i quess as dll's ?) to put to c:\php\extensions....?
wowiz
Forum Newbie
Posts: 13
Joined: Sat Aug 23, 2003 4:51 am

MYSTERY RESOLVED

Post by wowiz »

In php.ini for:
error_reporting = E_ALL
I added:
error_reporting = E_ALL & E_NOTICE

so when i was loading my apache, i got a pop-up warning window:
Unknown(): Unable to load dynamic library '.;c:\php\extensions\php_gd2.dll' - One of the library files needed to run this application cannot be found
so my attention got the '.;c:\php\extensions\php_gd2.dll' and i changed the setting (in php.ini) of:
extension_dir = ".;c:\php\extensions"
to:
extension_dir = "c:\php\extensions"

of course the ";extension=php_gd2.dll" is uncommented:
extension=php_gd2.dll

run the code:

Code: Select all

<?php
phpinfo();
?>
i got a gd section

IT WORKS :lol:
legsman
Forum Newbie
Posts: 1
Joined: Sat Aug 30, 2003 11:35 am
Location: east of londidium

grafics probbie

Post by legsman »

:wink: :wink:
i just copied all the extensions/ FILES.php to c:/windoze/system32
and ensure the directive in php.ini (ie; da extension line)
equalled to the c:/windoze/system32 directory.

after check iby running a phpinfo.php (contents shld have the followin..s:

<?
phpinfo();
?>)
running an individual check on 'one mod might not be advisable.

similarly, any ext you want to init just tick it off in the php.ini file

let me know how it went, yeah yeah
Post Reply