PDA

View Full Version : PHP has encountered a Stack overflow


marymac
23rd of July 2005 (Sat), 02:42
Hi Pekka -

First I'd like to thank you for the great gallery software. I've been using EE 1.5 RC4 for a little over a year and it's working great overall. I'm running EE on W2K Advanced Server with IIS 5.0.

Until now I've been using an action in PS to resize and save the various sizes of image, then uploading them to the server manually. I would then use the manual upload option to get the image and it's EXIF into the database. No problems there.

Now I'm trying to get Imagemagick to work so I can more easily load new pics to the server and I'm having a problem getting it running. All the resize tests etc work fine and the paths test out good, but when I try to load a file into the database without checking the "Manual File Upload" box I get a blank page with the error listed above, PHP has encountered a Stack overflow.

When I click Back to return to the Upload page I see the following message in the Messages window:

Fatal error: Cannot redeclare ee_ff2() (previously declared in C:\Sites\californiabirder.com\gallery\fetchsetting s.php:24) in C:\Sites\californiabirder.com\gallery\fetchsetting s.php on line 24

I downloaded and installed a new version of imagemagick tonight and that didn't fix it. I also confirmed that Safe Mode is off on my PHP config and I confirmed that php4isapi.dll is assigned as an ISAPI filter in IIS. My php and MySql date back to when I first installed EE 1.5, (php 4.2.3 and mySql 3.23.39) so they are out of date but as far as I know there haven't been any major updates to EE since then so I don't think that is the problem though I could be wrong! Any suggestions?

Thanks again! - Mary

Pekka
25th of July 2005 (Mon), 14:26
Sorry for late reply, I'm out of town and do not have much net access....

To me this sounds like a problem with PHP accelerator the server might be using.

marymac
25th of July 2005 (Mon), 14:57
This is a server I control and there is no accelerator installed as far as I know. I suspect the problem is related to IIS but I guess it's one you haven't seen. I will PM you a link to my phpinfo and maybe you can see something I'm missing... Thanks!

Pekka
26th of July 2005 (Tue), 06:00
You can try replacing

function ee_FF2($Value, $Precision) {
// function from http://www.php.net/manual/en/function.printf.php
$decimals = log10(abs($Value));
$decimals = - (intval(min($decimals, 0)) - $Precision);
$format = "%." . $decimals . "f";

$val = sprintf($format, $Value);
if ($val <= .005) return $val;
return "<span style=\"color: #ffff00;\">{$val}</span>";
}

with

if (!function_exists("ee_FF2")) {
function ee_FF2($Value, $Precision) {
// function from http://www.php.net/manual/en/function.printf.php
$decimals = log10(abs($Value));
$decimals = - (intval(min($decimals, 0)) - $Precision);
$format = "%." . $decimals . "f";

$val = sprintf($format, $Value);
if ($val <= .005) return $val;
return "<span style=\"color: #ffff00;\">{$val}</span>";
}
}

marymac
26th of July 2005 (Tue), 15:25
Thanks for the suggestion. I tried this but it led to the same error on the subsequent funtion in fetchsettings. I added the equivalent guard statement to each of the functions in fetchsettings which worked in the sense that it got through the fetchsettings document and went on to the next PHP document in the process (editor_upload?).

I got the same error each function in the other files (ftp_functions, editor_upload etc) so I guarded all those functions as well. Ultimately I arrived at a screen without an error to fix - it only displays the "PHP has encountered a Stack overflow" message and no error appears in my PHP log. Anyway, I'll try updating my PHP installation and go from there. Thanks again - Mary

marymac
8th of August 2005 (Mon), 12:10
Hi Pekka - I was able to solve this. Upgrading to PHP5 didn't fix the problem in istelf but I got better error messages that revealed an FTP problem. I fixed that and the Imagemagick problem went away. Thanks for your help - Mary