<?php
namespace App\Imports;
use App\Models\ExcelValidation;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\HasReferencesToOtherSheets;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;
class Validation implements ToCollection, WithCalculatedFormulas, HasReferencesToOtherSheets
{
private $upload_id = '';
/**
* Validation constructor.
*
* @param $id
*/
public function __construct($id)
{
$this->upload_id = $id;
}
/**
* @param Collection $rows
*/
public function collection(Collection $rows)
{
ini_set("max_execution_time", "-1");
ini_set("memory_limit", "-1");
set_time_limit(0);
foreach ($rows as $row) {
if (!empty($row[6]) && !empty($row[3]) && (strtolower($row[6]) == 'accurate' || strtolower($row[6]) == 'error')) {
$obj = new ExcelValidation();
$obj->status = strtolower($row[6]);
$obj->user_id = loginId();
$obj->excel_upload_id = $this->upload_id;
$obj->day_id = (int)date('w');
$obj->week = (int)date('W');
$obj->month_id = (int)date('m');
$obj->year = (int)date('Y');
$obj->source = $row[3];
$obj->save();
}
}
}
}
This is my code. Every thing is working fine on my local machine but when try to import file on the live server it gives 503 error. Its been 3 days i am working for its solution but all in vain. I have updated the execution_time to 1600 and post_max_size to 1024mbs and everything to maximum but did'nt work. Here is the error. Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request. Please help me if anyone has know the solution. Thanks
source https://stackoverflow.com/questions/73858231/i-got-the-503-error-on-import-an-excel-file-on-cpanel-laravel
No comments:
Post a Comment