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

Zoul's avatar
Level 5

Maximum execution time of 60 seconds exceeded

Hi all,

I did modify the time in pho.ini file to be max_execution_time = 1800 but i still having this issue. Any idea please ? Thanks

0 likes
35 replies
manishchauhan's avatar

Add this iline in your .htaccess

php_value max_execution_time 1800

And verify changes using

phpinfo();

Zoul's avatar
Level 5

Thanks @manishchauhan. When running php artisan serve, i see robots.txt in message error as well:

  PHP Fatal error:  Maximum execution time of 60 seconds exceeded in D:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php on line 255
  2024-10-14 15:26:26 ............................................................................................................. ~ 1m
  2024-10-14 15:26:26 ............................................................................................................. ~ 1m   
  2024-10-14 15:27:26 /robots.txt ..

robots.txt file having :

User-agent: *
Disallow: /user/*
Disallow: /admin/*
Sitemap: https://www.example.com/sitemap.xml

.htaccess

RewriteOptions inherit
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^example\.com$ "https\:\/\/www\.example\.com\/" [R=301,L]
php_value max_execution_time 1800

Zoul's avatar
Level 5

@manishchauhan verified and changes applied in phpinfo.php

max_execution_time	1800	1800
max_file_uploads	20	20
max_input_nesting_level	64	64
max_input_time	60	60
Zoul's avatar
Level 5

Hey @talnluck,, i did increase the memory but nothing changed memory_limit = 999M

Snapey's avatar

You have two lots of settings. Command line and web. What are you doing when you get this error?

Zoul's avatar
Level 5

Hi @Snapey, i'm just running : php artisan serve I'm working on it locally

Zoul's avatar
Level 5

@Snapey sorry for not being exact, i 'm working on sitemap.xml

JussiMannisto's avatar

@Zoul You were editing an xml file and this error popped up on your screen? Forget php settings and run a virus scanner.

Snapey's avatar

@Zoul its quite a simple question.

I was loading web route X

I was running artisan command Y

JussiMannisto's avatar

@Zoul That was a joke. It's not a virus.

You obviously didn't get this error when you were just editing an XML file. It's coming from a PHP script somewhere. But that could mean opening a web page, posting a form, running an artisan command or a queued job, etc. @snapey has been asking what you are doing when you get this error, but you haven't answered that. "Working on sitemap.xml" tells nothing.

Zoul's avatar
Level 5

This is how i got your question and my basic level of laravel could not help! Sorry ! Thanks for your support

experimentor's avatar

@Zoul @snapey and others are very helpful when they understand where the issue happened. Let me ask you in a slightly different way...

What happened after you did php artisan serve

  • were there any errors? If no, what did you do next? Did you open the url in browser? Did you get the "max execution time" error when you opened the url in the browser? If no, maybe you went to some route like /dashboard and the you got the error.

Please let us know when the error came. I think people can then understand what happened and give you better answers.

Zoul's avatar
Level 5

Hey @experimentor, i know and i appreciate their support. Many of the issue i faced, solved by @snapey, i'm just saying i could not provide the answer they wanted because of my limited knowledge maybe.

I'm trying to configure automatic sitemap, since last week, all i do is generating the sitemap files using php artisan generate:sitemap to see if i got the result i want by checking http://127.0.0.1:8000/sitemap.xml since i'm still not gettng the desired result, i keep changing and modifying methods, function etc. I did not have this issue right after i started working on sitemap, it was after some time. Beside that, i have not touched other configuration on my project. Hope i could give more informations.

Snapey's avatar

@Zoul "using php artisan generate:sitemap" was the answer I was looking for

This tells me that you are using command-line version of PHP and it is the CLI version that will be timing out, nothing to do with php artisan serve

Windows or Unix?

You can run php -i and then look for execution in the result

Zoul's avatar
Level 5

Sorry @Snapey, did not come to my mind that this was what you wanted. I have windows OS installed.

This is what execution shows after running php -i

Zend Max Execution Timers => disabled
max_execution_time => 0 => 0
Snapey's avatar

@Zoul max_execution_time of 0 means the script will never timeout. So php artisan commands can run as long as they like.

Which is at odds with your statement about it occurring when you run your console command.

By the way, your robots.txt error is nothing to worry about, its just saying that someone asked for it but you dont have one (thats normal). But what, on your local network is trying to load robots.txt?

Zoul's avatar
Level 5

@Snapey I'm connecting my laptop using my mobile wifi. I also deletd robots.txt file to see if something changes but i 'm still getting Maximum execution time of 60 seconds exceeded error

TruptMan-Solutions's avatar

@Zoul how many versions of php do you have locally installed?

did you restarted your pc after this change in php.ini file?

Snapey's avatar

If you are running under artisan serve then you should remember that it is only capable of running a single thread and executing one request at once. If you try and query your own server from within your application then it will hang and timeout.

Perhaps if you are trying to access the sitemap you created via a URL in your app ?

Snapey's avatar

@Zoul ok so,

  1. You made no mention in this question about the spatie package

  2. Eric is running this against a production site (not artisan serve). Building a local sitemap would be utterly pointless

  3. You don't mention if you are explicitly creating links or are crawling your site.

TruptMan-Solutions's avatar

@Snapey yes, sitemap created locally are pointless. But i did it by temprary pointing the url to my live site. @zoul can do this way also.

Zoul's avatar
Level 5

Hey @Snapey, sorry for missing out this, i also did mention in one of my reply another thread link pointing to sitemap issue, where i shared some ccdes. https://laracasts.com/discuss/channels/laravel/sitemap-is-not-working-on-multi-language-website#:~:text=Sitemap%20is%20not%20working%20on%20multi%20language%20website

From your point, i will delete all sitemap related code and redo it in production and see, finally to get rid of memory limit local issue. I wanted to check it first before delpoying in production becaue i'm not getting the desired results.

I'm trying to crawl my site, and have each link in 3 different language.

I appreciate so much your valuabe time

Zoul's avatar
Level 5

thanks @TruptMan-Solutions, could you please share how you temprary pointed the url to your website ? I can't open any of my application to test it locally as i have memory issue but it would be good to know.

TruptMan-Solutions's avatar

@Zoul

 public function sitemap1()
    {
		// in you app.php file under config folder . write the live site url.
		// then revert it back when you're done generating the sitemaps.
        $path = public_path('sitemap\sitemap1.xml');
        SitemapGenerator::create(config('app.url'))
            ->writeToFile($path);   
        dd('done');
    }
Snapey's avatar

If you use an alternate web server you might be ok, ie not artisan serve.

But you don't want a site map that links to local urls.

1 like
Zoul's avatar
Level 5

Thanks @Snapey will note of that. The problem now is , i deleted all related sitemap files and still having the same issue, can't run my project anymore locally. What could be the last resort for this ?

Snapey's avatar

@Zoul do you use Git? Checkout an earlier commit and check it works.

You are using Git arent you?

Please or to participate in this conversation.