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
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
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: -
$im = imagecreatetruecolor(100, 100);
-
-
imagealphablending($im, true);
-
-
imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0));
-
-
header('Content-type: image/png');
-
-
imagepng($im);
-
imagedestroy($im);
-
I would get the same error on line 4, the next GD function. Hope you can help.
REY
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.
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
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?
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
For some reason, it's not detecting my php_gd2.dll on my extension folder.
Darn. What am I doing wrong?
REY
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.
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.
@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
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.
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.
Is there no useful information in the error logs for PHP or IIS? Seems like IIS is just not displaying the error.
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
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.
@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..
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!
@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
.
Markus 6,050
Recognized Expert Expert
Glad we could all be of help :)
numberwhun 3,509
Recognized Expert Moderator Specialist Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
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...
| |