Page 1 of 1
image fns worked and now all of a sudden doesn't in IIS6
Posted: Sun Jun 13, 2004 1:03 pm
by anjanesh
Hello
I was using image functions and I got it to work by setting the extension_dir = "c:\PHP\extensions\" and extension=php_gd2.dll.
Everything worked ok and then I wanted to use imagerotate() but was not rotating. So I turned display_errors = On to find out the mistake and restarted IIS6. Now no image functions are working !!! Thats impossible because all I did was change display_errors = On. The image just does not load - and theres no warning or error. How is this so complicated ?
I also turned display_startup_errors = On but I'm sure this makes no difference.
Please help.
Thanks
Anjanesh
Posted: Sun Jun 13, 2004 1:09 pm
by feyd
check your error logs.. with some errors, display errors won't work because of some other problem before it could print anything...
Posted: Sun Jun 13, 2004 1:11 pm
by anjanesh
How do I find out the filename where these logs are created ?
I uncommented error_log and changed to
error_log = D:\Anjanesh\htdocs\ErrorLogs.txt
I ran the script again but there is no such file
Posted: Sun Jun 13, 2004 1:22 pm
by feyd
Posted: Sun Jun 13, 2004 1:26 pm
by anjanesh
I have this in test.php
<IMG SRC="images.php?text=hello" BORDER=0>
But there was no output so I ran images.php and I get these errors : This is really strange because it worked the first time I ran these scripts. All I did was change display_errors=On
These are the first 2 lines in images.php
Code: Select all
define(MAX_WIDTH,100);
define(MAX_HEIGHT,100);
Now I am getting this (unformatted html)
<br />
<b>Notice</b>: Use of undefined constant MAX_WIDTH - assumed 'MAX_WIDTH' in <b>D:\Anjanesh\htdocs\test\images.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Use of undefined constant MAX_HEIGHT - assumed 'MAX_HEIGHT' in <b>D:\Anjanesh\htdocs\test\images.php</b> on line <b>3</b><br />
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality with a lot of other junk (probably the image).
I checked the source (view-source) and this is exactly what came up. Now even if the image didn't show how can the html tags not ? My other non-images scripts are working fine
Posted: Sun Jun 13, 2004 1:30 pm
by feyd
you haven't defined MAX_WIDTH and MAX_HEIGHT... either you are using those in an array access, or they are supposed to be constants and you need to [php_man]define[/php_man]() them.
Posted: Sun Jun 13, 2004 1:34 pm
by anjanesh
Thats impoosible because after <?php I have
Code: Select all
define(MAX_WIDTH,100);
define(MAX_HEIGHT,100);
And the only time I have used them is
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
both $width & $height are having values.
And this EXACT script worked before without probs from definition
Posted: Sun Jun 13, 2004 1:36 pm
by feyd
define('MAX_WIDTH',100);
Posted: Sun Jun 13, 2004 1:37 pm
by anjanesh
Strange. Now I do this & it works.
define("MAX_WIDTH",100);
define("MAX_HEIGHT",100);
But I am positive that the code that I had before did not have the quotes. Why / How is this ?
Posted: Sun Jun 13, 2004 1:56 pm
by feyd
with display_errors on, all errors reported by the core will show.. those notices were there before, however they were being written to the error logs (or not written, depending on your default error_reporting level)
Posted: Sun Jun 13, 2004 2:01 pm
by anjanesh
Thanks. SOLVED.
In my php.ini error_reporting = E_ALL
Either way I got the result done some other way. I'll have to keep in mind these changes
Posted: Sun Jun 13, 2004 2:36 pm
by John Cartwright
You should always have display errors on...
It will cause you much less pain in the long run when developping scripts by knotting out every little error.