addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [php-337] timeout problem

From: Jason S.
Sent on: Monday, July 20, 2009 4:27 PM
Anything in the php / apache error log?

Sounds like you are not even getting to the first echo statement, which means its timing out doing

$file_f = join('', file($filef));

Why are you using file() to read the file into an array, only to implode it back into a string again (join) and then make it into an array again with preg_split??

$recordsf = file($filef);
$recordsv = file($filev);

That should be enough to get everything into an array.

Jason

On Mon, Jul 20, 2009 at 4:17 PM, Frank_in_NY <[address removed]> wrote:
nothing appears on the screen. It shows that its busy for a few seconds and then it just ?says "done" at the bottom of the browser.

>>> Jason Salsiccia <[address removed]> 7/20/2009 4:14 PM >>>

Hey Frank,

How many iterations of filef lines does it go through before timing out?

With the nested loops, it looks like a max of 10 million or so iterations (3900 * 2900) which should be doable.

Jason

On Mon, Jul 20, 2009 at 3:56 PM, Frank_in_NY <[address removed]> wrote:
I have this simple code that seems to time out. It reads in two external files(3900 lines & 2900 lines of text ) into two arrays and compares one file to the other to see how many matches there are. For some reason it only works when I use the test files (10 lines of text). Can someone tell me why its not working?
Frank
PS: I recently added the memory statement ,but it still doesnt work.
<?php
$filef = 'f.txt';
$filev = 'v.txt';
//ini_set(max_execution_time,900);
ini_set ( "memory_limit", "20M");
// check to make sure that file exists
//if (!file_exists($file1) {
// die("Cannot find file!");
//}
// read the whole file into a string
$file_f = join('', file($filef));
echo "filesf was read in"."<br>";
$file_v = join('', file($filev));
echo "filev was read in"."<br>";
// split our long string
$recordsf = preg_split ("/(\r?\n)/", $file_f);
$recordsv = preg_split ("/(\r?\n)/", $file_v);
echo "preg split done"."<br>";
foreach ($recordsf as $rf) {
$rf = trim($rf);
if ($rf != '') {
foreach ($recordsv as $rv) {
$rv = trim($rv);
if ($rv != '') {
If ($rf===$rv)
echo "we have a match- Faculty".$rf." - Video faculty".$rv."<br>";
else
echo "no match for ".$rv."<br>";
}

}
}
}
?>




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Frank_in_NY ([address removed]) from The New York PHP Meetup Group.
To learn more about Frank_in_NY, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup Support: [address removed]
632 Broadway, New York, NY 10012 USA





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jason Salsiccia ([address removed]) from The New York PHP Meetup Group.
To learn more about Jason Salsiccia, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup Support: [address removed]
632 Broadway, New York, NY 10012 USA




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Frank_in_NY ([address removed]) from The New York PHP Meetup Group.
To learn more about Frank_in_NY, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup Support: [address removed]
632 Broadway, New York, NY 10012 USA

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy