The script runs and redirects to the main?

In General faced with such a problem.

Download big .csv file, about 300 MB, in addition this file contains a link to the image you want to upload to the server, then update the data in the database.

During execution, the script performs a maximum of 100 iterations and redirects to the main page.

Please tell me what it involves and how it can be avoided.
October 8th 19 at 01:55
4 answers
October 8th 19 at 01:57
max_execution_time
memory_limit

Maybe that's because of these guidelines?
as an option add logging using set_exception_handler and set_error_handler - celia.Carter82 commented on October 8th 19 at 02:00
max_execution_time is set to 0
memory_limit set to 256 - emerald27 commented on October 8th 19 at 02:03
since you have a 300Mb file, and the memory_limit to 256, then let me suggest that you read it in a single variable, not freeing memory, respectively, by simple calculations we can identify your problem. - celia.Carter82 commented on October 8th 19 at 02:06
No, no. I read one line — do import the images to a server, update data in the database and delete the variable that contains this string.
while(($data = fgetcsv($handle, 5000, $separator)) !== FALSE)
{
$imageAdmin->importImagesFromUrls(false, array('http://www.alphashirt.com'.$data[16]), $importImages, $importImageErrors);
if(empty($importImageErrors))
{
$update = array(
'vcimage' => $importImages[0]->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_TINY, true, false),
'vcimagezoom' => $importImages[0]->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, false),
'vcimagestd' => $importImages[0]->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, false),
'vcimagethumb' => $importImages[0]->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, false)
);
$GLOBALS['ISC_CLASS_DB']->UpdateQuery('product_variation_combinations', $update, "vcsku='". $GLOBALS['ISC_CLASS_DB']->Quote($data[1]). "'");
}
unset($data);
} - emerald27 commented on October 8th 19 at 02:09
Return status — the usual 404.
In this case, if the number of iterations to reduce to ~300 — script works correctly. Ie, the document itself exists, then probably the case in some server settings, only in what direction to look I do not know. - emerald27 commented on October 8th 19 at 02:12
October 8th 19 at 01:59
As they say: miracles do not happen — look for the error.
Look in fire bug how the redirect occurs, if at all. I suggest to look for in your code the "Location:" and put it with debug_prit_backtrace exit();
As one of the possible situations, there is some kind of fatal error/exception and the script launches error_handler/exception_handler/shutdown_function where there is a redirect.
Location — did you mean header? In the code, no redirects.
Determined error_handler/exception_handler/shutdown_function, but no result is not given. - celia.Carter82 commented on October 8th 19 at 02:02
October 8th 19 at 02:01
Try from a file to get less number of records (~30). If all done, then see habrahabr.ru/qa/17458/#answer_71933

If will not help — it is necessary to look code.
Yes, up to 300 entries, the script works correctly. - celia.Carter82 commented on October 8th 19 at 02:04
October 8th 19 at 02:03
Maybe it's the web server got tired of waiting and he decided to redirectout on the main for a time-out? Or some very clever service neponravilos that something is very long and it killed the process?
There's something interesting in the logs of the web server?
No, service no, there is not used. Log php errors clean, as if no errors are not present, but access to the server log no... - celia.Carter82 commented on October 8th 19 at 02:06

Find more questions by tags PHP