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

Re: [php-337] timeout problem

From: Sam I.
Sent on: Monday, July 20, 2009 5:09 PM
Why don't you configure the error log in a way you can read it?


<?php
error_reporting( E_ALL );
ini_set( 'track_errors' , 1 );
ini_set( 'display_errors' , 1 );
ini_set( 'html_errors' , 0 );
ini_set( 'error_prepend_string' , '' );
ini_set( 'error_append_string' , '' );
ini_set( 'report_memleaks' , 1 );
ini_set( 'ignore_repeated_errors' , 1 );
ini_set( 'log_errors' , 1 );
ini_set( 'log_errors_max_len' , 0 );
ini_set( 'error_log' , (dirname(__FILE__) . '/error_log.txt') );
?>

Paste this into a file (php), create a file within the same directory error_log.txt and make sure to give write permission, use 666 if you don't know how your HTTPD executes your scripts (if you know it uses suExec you can use 600).


There's a reason why you get a blank page, it dies. Could be a time-out use this to prevent it:

set_time_limit(0);

It could also be that you have a syntax error, are you using an IDE to program? If so, it would probably show you that there's an error with your code.

- Sam


On Mon, Jul 20, 2009 at 4:54 PM, Frank_in_NY <[address removed]> wrote:
I just tried that now, but it didnt work. It gave me the same blank page. I'll have to ask the admin on Wednesday for the error log. I dont have access to that. Anyway, thanks.
Frank
PS: Im fairly new to coding in PHP. And I used that method?to get structured records, but now I see that I did not need to do that. thanks
?

>>> Jason Salsiccia <[address removed]> 7/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





--
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