473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP GD support problem

23 New Member
Hi! I am using php5 extracted from the zip package downloaded from php.net. I have already set the php_gd2.dll extension at the php.ini as well as the extension_dir. However, I still get error undefined function everytime I use a GD function. I read that I have to configure php with GD support. How to do that with php5. I have also downloaded the GD lib but don't know how or what to do to configure it. Please advies.

A novice PHP developer
Mar 4 '09 #1
19 3847
numberwhun
3,509 Recognized Expert Moderator Specialist
@rsbgm

First, what OS are you on? (ie: Windows, Linux, etc). Second, you say you are getting errors. Can you please post them?

Regards,

Jeff
Mar 5 '09 #2
rsbgm
23 New Member
Hi Jeff,
I'm on Windows XP Pro. The error I get is:

Fatal error: Call to undefined function imagecreatetruecolor() in C:\Inetpub\wwwroot\MyWeb\image_test.php on line 2

The code is:

Expand|Select|Wrap|Line Numbers
  1. $im = imagecreatetruecolor(100, 100);
  2.  
  3. imagealphablending($im, true);
  4.  
  5. imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0));
  6.  
  7. header('Content-type: image/png');
  8.  
  9. imagepng($im);
  10. imagedestroy($im);
  11.  
I would get the same error on line 4, the next GD function. Hope you can help.

REY
Mar 5 '09 #3
Markus
6,050 Recognized Expert Expert
Have you gone through all the steps here? Have you uncommented the gd extension line in the php.ini file?
but calling it without GD2 being installed PHP will issue a fatal error and exit.
Mar 5 '09 #4
rsbgm
23 New Member
Hi Markus,

Yes, sir, I did. I uncommented it. Even tried to put a tag [PHP_GD2] on the extension=php_gd2.dll like:

[PHP_GD2]
extension=php_gd2.dll

Still doesn't work. Still wont recognize GD functions. I really hope you can help resolve this.

REY
Mar 5 '09 #5
Markus
6,050 Recognized Expert Expert
@rsbgm
And you have restarted the server?

Try creating a php file and inside write gd_info() then view the file's output (if any). What does that give you?
Mar 5 '09 #6
rsbgm
23 New Member
Hi Markus,

Yes, I've re-started the server. I just did your gd_info() test and got the same fatal error.

Fatal error: Call to undefined function gd_info() in C:\Inetpub\wwwroot\MyWeb\gd_info.php on line 2

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. gd_info();
  3. ?>
  4.  
For some reason, it's not detecting my php_gd2.dll on my extension folder.
Darn. What am I doing wrong?

REY
Mar 5 '09 #7
hoopy
88 New Member
Where do you have the php_gd2.dll file located?

Have a check of the file permissions for the dll as well make sure its readable, etc.
Mar 5 '09 #8
Markus
6,050 Recognized Expert Expert
Does the gd2 dll exist in your ext (extension) directory? If you do a phpinfo() call on your page, what does your extension_dir show? Is that correct?

I don't know what you're doing wrong :P

I find silly little problems arise all the time, especially when I'm trying to configure a server. Some things work, some things just don't.

What are you using for a server? I recommend using EasyPHP or XAMP - they make dealing with the server very easy.
Mar 5 '09 #9
rsbgm
23 New Member
@hoopy

The php_gd2.dll is located in the ext folder. it's readable, in place, and set properly in my php.ini file. I got it working now though (see response below to Markus).

@markus

You were right about conflict of directories. Apparently, the config file is not loaded as indicated on phpinfo() and the extension_dir indicated there is c:\php5 while my php root dir is c:\php (without the 5). I have included c:\php (w/o the 5)on my PATH and the extension_dir inside php.ini is set to c:\php (w/o the 5). So, I wondered why.

I tried to change my php root dir and renamed it to c:\php5 which caused the browser not to find the module anymore. I returned it to c:\php (w/o the 5).

I realized that one of the ways the config file is searched is through the registry. So, I added a reg key for ... PHP/5/IniFilePath -> c:\php ... BINGO! It worked. My GD functions are now working. Thanks to all of you guys!!!

A NEW PROBLEM

A new problem arose though. Everytime I access phpinfo() or gd_info(), I get a blank page. Now, why is that?

REY
Mar 6 '09 #10
Markus
6,050 Recognized Expert Expert
Wow! I'm very glad you got that working. We get that question a lot, and often times, I have no idea what the issue is, but now we have some more insight into the problem. So, a big thanks to you.

You know, I seem to get the same problem when using the gd_info() call. I get a blank screen. If I do a print_r(gd_info()) it shows me the output, but I thought gd_info was much like phpinfo() in the way that it gives you output automatically. I've never experienced that with phpinfo(), though.
Mar 6 '09 #11
rsbgm
23 New Member
Yes, the print_r(gd_info()) prints the corresponding output for me too. But, dang, that phpinfo() thing sucks. I am unable to to check on some needed info for debugging or whatever purposes.
Mar 6 '09 #12
hoopy
88 New Member
Is there no useful information in the error logs for PHP or IIS? Seems like IIS is just not displaying the error.
Mar 6 '09 #13
Markus
6,050 Recognized Expert Expert
I imagine it's because you've changed the registry. Is this an IIS server? I'm doing some research now, I'll see what comes up. Don't hold your breath, though. :P
Mar 6 '09 #14
Markus
6,050 Recognized Expert Expert
Can you access specific elements of the php_info, as outlined here? (also, did you try echo()ing phpinfo(), instead of just calling it?)

I'm scraping the walls for possibilities here.
Mar 6 '09 #15
rsbgm
23 New Member
@hoopy

Yes, it seems that IIS doesn't log errors. I'm not really sure about this too.

@markus

I couldn't access specific elements as outline in php.net. I tried it several times. As far as the registry is concerned, I only added a key. I did not change anything. But...... Alas! I somehow stumbled into a solution accidentally.

Now, I'm not sure if this provides good info for everyone. This is kinda embarrassing too. You may want to check it out on your side as well.

If I understand it correctly, the 'php' after the '<?' at the start of the code is not necessary. I guess not for all circumstances. For some reason, I saw that I am missing the 'php' after the '<?' on the phpinfo.php code to display the phpinfo(). I always place it as a good programming practice. And when I typed it back, everything is fine now. I can see the phpinfo() again. If I remove it, the page will display blank again. Hmmm...

Now, I am pretty certain that if I did miss placing that 'php', how was I able to access it before the resolution of the GD functions issue. I couldn't have accidentally erased it. It was just yesterday. Dang! Now, I wouldn't know. Hehe..

My bad!

Oh! The gd_info() is still blank. So, we are now on the same track. Hehe..
Mar 6 '09 #16
Markus
6,050 Recognized Expert Expert
You don't need to use <?php if you have shorttags enabled (then you can just use <? - but most programmers are against using it).

After checking the documentation on gd_info(), it shows the it does in fact return an array. So you have to access it like an array (not like phpinfo()).

Glad you got everything working!
Mar 6 '09 #17
rsbgm
23 New Member
@markus

Thank you very much! Thanks for the gd_info() information. Now, I also understand.

@numberhwun
@hoopy

Thank you very much as well.

Thanks to every one and I hope that this thread can help others too.
Go, go, go, PHP addicts... :D

.
Mar 6 '09 #18
Markus
6,050 Recognized Expert Expert
Glad we could all be of help :)
Mar 6 '09 #19
numberwhun
3,509 Recognized Expert Moderator Specialist
@Markus
Agreed! :) .
Mar 7 '09 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2240
by: Naresh | last post by:
I have been having a problem and I don't know where to go for help. The microsoft support is only for a fees. Can anyone at all please at least point to a site or some place where I can hope for some...
5
3477
by: shaun.mostashari | last post by:
Hello all, I am working on a trade study and one of the criterias is how easy it is to get DB2 technical support from IBM. I appreciate if you guys share your experience with me. Does DB2 have a...
5
3288
by: NormaJean Sebastian via DBMonster.com | last post by:
Hi, I almost read all of the "DB2 vs Oracle" thread... The summary I got from that was all databases essentially do the same things, the decision of which one you use primarily depends on...
22
23315
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
4
20540
by: Molina | last post by:
Hi !!! I have a VB.Net application that consumes an WebService. The problem is that the HTTP address works fine, but it will change to an HTTPS address, and it isn't working. The weird thing...
3
1829
by: Pramod TK | last post by:
Hello All, I have some queries related to python support for IPv6. Can you kindly clarify the doubts which I have - 1. Does python support IPv6? 2. Does it support setting of QoS flags? 3. Does...
2
3493
by: needin4mation | last post by:
I can't find out if Microsoft supports "Classic" asp or if they only support asp.net? I'm not really sure what support means in either context, really, except that they tell customers not to use...
14
4814
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
0
2200
by: Jack Wu | last post by:
Hi I've spent a good majority of my day trying to figure out how to have PIL 1.1.5 working on my OSX 10.3.9_PPC machine. I'm still stuck and I have not gotten anywhere. Could somebody please...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.