troubleshooting Question

How do I get rid of the error: maximum execution time of 60 minutes exceeded, when loading a json file with laravel

Avatar of B O
B O asked on
PHPLaravelJSON
14 Comments1 Solution27 ViewsLast Modified:


code:
$contactInfo = Storage::disk('local')->exists('challenge.json') ? json_decode(Storage::disk('local')->get('challenge.json'), true) : [];
        
            // $json = $contactInfo[0]; // turn std object to array
            foreach ($contactInfo as $contactDetail ){
                $contact = new User; // assumes you have a Model called Contact
                $contact->name = $contactDetail['name'];
                $contact->address = $contactDetail['address'];
                $contact->checked = (!$contactDetail['checked'] === false) ? $contactDetail['checked'] : 'false';
                $contact->description = $contactDetail['description'];
                $contact->interest = (!$contactDetail['interest'] === null) ? $contactDetail['interest'] : 'null';
                $contact->date_of_birth = (!is_null($contactDetail['date_of_birth'])) 
                ? 
                substr(preg_replace("([^0-9/])", "", $contactDetail['date_of_birth']), 0, 8) 
                : 
                new DateTime('2000-01-01');
              
                $contact->email = (!$contactDetail['email'] === null) ? $contactDetail['email'] : 'null';;
                $contact->account = $contactDetail['account'];
                $contact->save();
                $sensitive_data = new Creditcard;
                $sensitive_data->type = $contactDetail['credit_card']['type'];
                $sensitive_data->number = $contactDetail['credit_card']['number'];
                $sensitive_data->name = $contactDetail['credit_card']['name'];
                $sensitive_data->expirationDate = $contactDetail['credit_card']['expirationDate'];
                $sensitive_data->save();
            }

Error when loading longer than a minute:




ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros