Pages: 12Next
Current Page: 1 of 2
Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (65.57.245.---)
Date: September 23, 2006 03:22PM

I am using WAMP5. But when I am trying to run a run a simple code that contains imagecreate() function. I am getting an error mentioned below.

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\test.php:8) in C:\wamp\www\test.php on line 9

I have enabled php_gd2.dll..I have chekd the code it is perfectly fine. Can anyone help me out with this problem.

Thanx

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (67.170.181.---)
Date: September 23, 2006 04:20PM

did you restart apache after you enabled the gd extensions. you need to restart apache for your changes to take effect

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 27, 2006 08:13AM

yeah i have restarted all the services but i still get this error mentioned below.

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\test.php:8) in C:\wamp\www\test.php on line 9

test.php is my file name.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (67.170.181.---)
Date: September 27, 2006 09:21AM

post your php code

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 27, 2006 10:27AM

Here is my code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[www.w3.org];
<html xmlns="[www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GD Configuration Test</title>
</head>
<body>

<?php
header ("Content-type: image/png"winking smiley;
$im = @ImageCreate ( 50, 100)
or die ("Cannot create a new GD image."winking smiley;
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color );
ImagePng ($im);
?>

</body>
</html>

Error description is there in my earlier post

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (67.189.46.---)
Date: September 27, 2006 05:03PM

you are getting this error because you have allready outputed data (in your case some html code) to the browser. to get your script to work, change it to:


<?php
header ("Content-type: image/png"winking smiley;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[www.w3.org];
<html xmlns="[www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GD Configuration Test</title>
</head>
<body>

<?php
$im = @ImageCreate ( 50, 100)
or die ("Cannot create a new GD image."winking smiley;
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color );
ImagePng ($im);
?>

</body>
</html>

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 28, 2006 03:20AM

Changed the code as you mentioned above but now I am getting new error which I have mentioned below.


Error Message: The image “[localhost]” cannot be displayed, because it contains errors.

test.php is my filename.

I am not able to figure out as to why am I getting this error now. I am using Firefox and I reckon this is msg from the browser. Tried in Internet Explorer but getting a blank page.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: September 28, 2006 03:54AM

to see what errors you are getting change
$im = @ImageCreate ( 50, 100)

to
$im = ImageCreate ( 50, 100)

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 28, 2006 06:52AM

tried doing as you said but getting same error in Firefox as mentioned above..

but in Internal explorer it says
Fatal error: Call to undefined function ImageCreate() in C:\wamp\www\test.php on line 13

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: September 28, 2006 04:51PM

double check and make sure you have correctly enabled the gd2 extension, make a new php file with the following code and run it in your browser

<?php
var_dump(gd_info());
?>

if you get an error saying undefinded function, then you have not enabled gd2. enable it and everything should work.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 29, 2006 03:32AM

yeah i have run the code given by you and i am getting the error undefined function..i think my gd2 is not correctly configured....i will explain what i have done to enable gd2 and what i know...

First of all I have 2 php.ini files in my system one in c:\Windows directory and other in c:\wamp\Apache2\bin. is it correct to have 2 files or do I have to remove one.if so which one do i have to delete???Now this is what I have done...

1. I have uncommented "extension=php_gd2.dll" from php.ini files present in c:\wamp\Apache2\bin and c:\windows by removing the semi-colon from the beginning of the line.

2. I have also modified the directive "extension_dir" in php.ini file. I have kept the directive as
extension_dir = "./ " for php.ini in c:\Windows directory and
extension_dir = " c:/wamp/php/ext/ " for php.ini in c:\wamp\Apache2\bin directory.

Finally how do i know from the phpinfo() that gd2 is enabled???

Finally Thanx a ton for patiently guiding and helping me in all this time..I will be really grateful to you once my gd2 is up and running...I have been trying to do this since long...

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: September 29, 2006 04:56AM

do i have to do anything else for gd2 to run correctly apart form the steps mentioned in my earlier post..also i have restarted the server and all its services..but still gd2 is not properly enabled..can you please tell me if i have missed any thing or done anything wrong..if so please tell me the steps to follow for enabling gd2 correctly and running it.......

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: CyberSpatium (67.170.181.---)
Date: September 29, 2006 05:45PM

to enable gd2 use the wamp trey icon menu. click on the menu -> php extensions and make sure php_gd2 is slected, if not select it.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: smiley76 (---.160.172.2.static.vsnl.net.in)
Date: October 03, 2006 04:14AM

I have now enabled gd2 as u said..and i am also able to see gd2 enabled instruction if i am using phpinfo() function..

also when i used
var_dump(gd_info());
the above function i am getting the result mentioned below on the browser

array(12) { ["GD Version"]=> string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(true) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(false) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }

which i reckon means that gd2 is now enabled perfectly...

but when I am trying to execute my code i am still getting the same error msg. I have pasted my code and also the error msg below:

Code:

<?php
header ("Content-type: image/png"winking smiley;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[www.w3.org];
<html xmlns="[www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GD Configuration Test</title>
</head>
<body>
<?php

$im = @ImageCreate ( 50, 100)
or die ("Cannot create a new GD image."winking smiley;
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color );
ImagePng ($im);
?>
</body>
</html>

Error Msg:
The image “[localhost]” cannot be displayed, because it contains errors.

I reckon we are getting this msg because of the headerheader ("Content-type: image/png"winking smiley; that we have written in the beginning of the file. Tried placing the header statement at different places but still getting the same error.

Can you pls find a solution for this error now.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: raxsv (---.home.nbox.cz)
Date: February 23, 2007 11:11PM

smiley76 did you somehow solve this problem? I have virtually the same problem.
Already read posts in this topic all aspects seems to be the same. I have even try this scripts with exactly same error.
Anyone knows where could be problem?

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: yfastud (---.cable.mindspring.com)
Date: February 23, 2007 11:31PM

Quote

First of all I have 2 php.ini files in my system one in c:\Windows directory and other in c:\wamp\Apache2\bin. is it correct to have 2 files or do I have to remove one.if so which one do i have to delete???Now this is what I have done...
On my own experience, this wamp never has php.ini in windows folder, so you guys might already has php installed before, and by default php will look for ini in windows which results it never reach the ini file that comes w/ this wamp package; so make sure to search and delete all related files in windows and registry if ever had apache, mysql and php installed before.

Have fun

[www.jlbn.com] (testing web server)
[test.jlbn.com] (testing codes)
[forum.jlbn.com] (testing phpBB2)
[forums.jlbn.com] (testing phpBB3)
[mail.jlbn.com] (testing mailserver)
[ftp.jlbn.com] (testing ftp server)
[www.jlbn.com] (testing flashes)
[www.jlbn.com] (testing images)
[joomla.jlbn.com] (testing Joomla 1.0.10)
[fusion.jlbn.com] (testing phpFusion 6.01.6)
[nuke.jlbn.com] (testing phpNuke 7.9)
[nukep.jlbn.com] (testing phpNuke Platinum 7.6.b.4v2)
[pnuke.jlbn.com] (testing PostNuke 0.800-MS2)
[nukevo.jlbn.com] (testing phpNuke Evolution 2.0.1)
[wp.jlbn.com] (testing WordPress 2.1)
[ws.jlbn.com] (testing WebSpell 4.01.02)

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: raxsv (---.home.nbox.cz)
Date: February 24, 2007 12:12AM

Thanks for quick answer.
But unfortunately it doesnt help.
I search all (one) php.ini in windows and delete it. Besides i tried to download new wamp server and it looked for php.ini in windows and reneme that to "old_php.ini" anyway (i delete this file too, just to be sure).

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: malwin23 (---.ztpnet.pl)
Date: February 24, 2007 12:25AM

heh i have the same problem. But the answer is somhere in windows setting. There is no other way!
Whole package of Wamp is installing correctly. Changes in the php.ini are saving to. Ther must be somtehing with windows.

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: raxsv (---.home.nbox.cz)
Date: February 24, 2007 12:33AM

I have tried this on two different computers (both with windows xp).

Options: ReplyQuote
Re: Unable to configure php_gd2.dll in wamp
Posted by: malwin23 (---.ztpnet.pl)
Date: February 24, 2007 12:37AM

Ok i will install Wamp 1.6.0 version let see what happend.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.