Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shariff's avatar
Level 51

Maximum execution time of 60 seconds exceeded for simple query

Hi

I have written a simple query for checking email id already exist or not. In local it is working fine. when I uploaded in plesk server I am getting this error . Is anything wrong in my code?

Maximum execution time of 60 seconds exceeded

controller


 public function update(Request $request, $id)
    {
        $checkEmailExist = User::where('email',$request->email)->where('id','!=',Auth::user()->id)->first();
        if(is_null($checkEmailExist))
        {
            User::find(Auth::user()->id)->update([
                'name' => $request->fullname,
                'email' => $request->email,
                'mobile' => $request->mobile,
            ]);

           return redirect()->route('member-registration.edit',[$id])->with('success','Profile Details Updated Successfully');

        }
        else
        {
            return redirect()->route('member-registration.edit',[$id])->with('success','Email Id Already Exist');
        }

        
        
    }

0 likes
7 replies
jlrdw's avatar

Check setting in php.ini. or wherever that setting is for that server.

shariff's avatar
Level 51

@jlrdw in this server I am unable to find where I can change settings. My question is for small query Y its taking that much time. Anything wrong in my code?

Snapey's avatar

you mean apart from the fact that you don't just use the unique validation rule?

no, I cant see why this should take 60 seconds

siangboon's avatar

the system is just telling what was happening... the issue can be many, such as number of records in the table, the indexing, the resources of the server allocated, network connection performance... until you able to find out which part that causing long time execution, modify the php.ini is the quick fix but not for long term...

try enable the debugbar, telescope or Clockwork extension or any debug tool to check the total time it take, it seem you are making multiple query...

shariff's avatar
Level 51

@snapey @siangboon I have only 600 records. If I try to increase execution time in controller

set_time_limit(0);

I am getting this error

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

Snapey's avatar

The problem is not with the code you show.

Install Laravel Debugbar to try and track down the issue.

If you have errors such as the above, look in the Laravel log files.

1 like
siangboon's avatar

check the log and you need debug tool to trace the issue...

simplify the query first and add complexity bit by bit to find out which part of query that cause time out...

if even a simple select query can cause timeout, most likely something wrong with your resources or environment setup, such as connection to the DB server may already an issue....

1 like

Please or to participate in this conversation.