× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Alan,
Just ran the script via php-cli and it worked fine.
I intended to migrate to cli since the input could be a csv file that is too large for processing on the server.

But I'd like to know what is limiting the response on the server. The code is as simple as you'd see on any PHP thread.
Damned if I can remember where to look for the log, it's been a while?

Peter

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Alan Seiden
Sent: Tuesday, 22 April 2014 5:20 p.m.
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] PHP image loop throws HTTP 500 error

What does php.log say?

Alan

Peter Connell wrote:
I'm trying to use PHP to output text strings as images ( a security measure) in a loop.
It works fine for up to 10,000 iterations but throws the wretched 500 Internal Server Error when I try 20,000.

It's like there's a memory leak but I've pared the code back and still have no idea what's wrong.
Here's an example - can anyone else try it?
Note - I've removed the code that uses the csv.png file containing the
text as an image

<?php


function OutputToDataURI($text) {
$im = imagecreate(550,18);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 550, 18, $white);
imagestring($im, 3, 1, 1, $text, $black);
$imgdata = "csv.png";
imagepng($im,$imgdata,0,NULL);
imagecolordeallocate($im,$white);
imagecolordeallocate($im,$black);
imagedestroy($im);
// do something with the file csv.png here }

$n = 0;
While($n< 20000)
{
$n = $n+ 1;
echo "<br>$n";
$text = "Hello $n";
OutputToDataURI($text);
}


echo "<p>Done n= $n";
exit();


?>



######################################################################
###############

This correspondence is for the named person's use only. It may contain
confidential or legally privileged information, or both. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this correspondence in error, please immediately delete
it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual
sender, except where the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :- Australia
customerassistance@xxxxxxxxxxx or New Zealand +64 9 367 6200
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.

#####################################################################################

This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :-
Australia customerassistance@xxxxxxxxxxx or New Zealand +64 9 367 6200

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.