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 3729 @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
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
@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.
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
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.
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
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..
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
.
Glad we could all be of help :)
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...
|
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...
|
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...
|
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...
|
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...
|
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? ...
|
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,...
|
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...
|
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...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: tammygombez |
last post by:
Hey everyone!
I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
| |