Hello all.
I have an identical script running on IIS and on Apache, using Windows and Linux respectively.
The thing is, on the linux box I can run a script that reads a CSV and downloads images all day long with set_time_limit throughout the script.
On the Windows box, it always seems to die at a time out of 60 seconds on a file_get_contents.
I've tried chaning the php.ini setting to 84600 seconds on max execution time, but it doesn't matter. I have also used ini_set to increase the socket timeout to 180 seconds to no avail.
Anyone have any ideas?
TIA
function download($url){
$img = file_get_contents($url);
$this->source['name'] = basename($url);
$h = fopen($this->path.DS.$this->source['name'], 'wb');
if(fwrite($h, $img)){
return true;
} else {
return false;
}
return false;
}
/** give new time limit **/
set_time_limit(60);
/** loop over each $data/line **/
foreach($data as $key => $line){
#echo '<pre>'; print_r($data); echo '</pre>';exit;
/** check for features in DB **/
$allFeatures = array();
/** add new ones and map them all **/
$allFeaturesStr = '';
/** get images, resize and save **/
$allImages = array();
$thisImages = $line['images'];
foreach($thisImages as $iK => $imgVal){
/** get images, resize and save **/
$IMG = new Image(array('name' => basename($imgVal)), ROOT_DIR.DS.'listings');
echo 'Trying to get image number '.$iK.'...';
if($IMG->download($imgVal)){ // eventually times out here at diff spots
$IMG->resize(IMG_H, IMG_W);
if(WATERMARK == 1) $IMG->watermark();
$allImages[] = basename($imgVal); # img name
echo 'got it<br />';
}
/** give new time limit **/
set_time_limit(60);
}
$inv = new Inventory($POST);
$inv->setImages(implode(",", $allImages));
$inv->insert();
/** give new time limit **/
set_time_limit(60);
echo 'Line '.$key.' complete<br />';
}