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

eidmohd89's avatar

Maximum execution time not working!

Dear lovely deops, I am getting the following error on my staging server:

Symfony\Component\Debug\Exception\FatalErrorException
Maximum execution time of 30 seconds exceeded

From the nginx configuration, I see the max_execution_time is set to 10 minutes. For some reason, I still get the maximum timeout of 30 seconds.

Has someone faced this issue before? Your suggestions and help would be really appreciated.

server {
   listen 80 default_server;

   location /healthcheck {
       root /var/www/my-proj/current/public;
       try_files /index.php =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass    127.0.0.1:9000;
       fastcgi_index   index.php;
       fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
   }

   location / {
       return 301 https://www.staging.my-proj.net$request_uri;
   }
}

....

server {
    listen 443 ssl default_server http2;
    ssl_certificate /etc/nginx/ssl/my-proj-web.crt;
    ssl_certificate_key /etc/nginx/ssl/my-proj.key;

    location / {
        return 301 https://ww.my-proj.net$request_uri;
    }
}

server {
    listen 443 ssl http2;
    root /var/www/my-proj/current/public;
    allow all;

    server_name ;
    ssl_certificate  ....;
    ssl_certificate_key ....;

    client_max_body_size 200M;

    add_header Strict-Transport-Security "max-age=63072000;";

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_intercept_errors off;

    index index.php index.html;

    location ~* \.(?:pdf|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|ttf|eot|yaml)$ {
        try_files $uri /index.php?$args;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        add_header Access-Control-Allow-Origin * always;
    }

    location = /sitemap.xml {
        proxy_pass https://..../sitemap.xml;
        proxy_set_header       Authorization '';
        proxy_hide_header      x-amz-id-2;
        proxy_hide_header      x-amz-request-id;
        proxy_hide_header      Set-Cookie;
        proxy_ignore_headers   "Set-Cookie";
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location /api/v1/import-suburbs {
        try_files $uri $uri/ @long;
    }

    location @long {
        try_files $uri /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_read_timeout 600;
        fastcgi_param PHP_VALUE "max_execution_time=600";

        if ($http_origin ~ "(test)\.my-proj\.net$") {
            add_header Access-Control-Allow-Origin "$http_origin" always;
            add_header Access-Control-Allow-Credentials 'true';
        }
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_read_timeout 600;
        fastcgi_param PHP_VALUE "max_execution_time=600";

        if ($http_origin ~ "(test)\.my-prok\.net$") {
            add_header Access-Control-Allow-Origin "$http_origin" always;
            add_header Access-Control-Allow-Credentials 'true';
        }
    }

    location ^~ /blog/ {
        proxy_set_header Host "www.my-proj.net";
        proxy_pass http://test.my-proj.net;
    }

    location ^~ /my-packages {
        proxy_pass http://my-package.my-proj.net/;
    }
}

server {
    listen 443 ssl http2;
    root /var/www/my-proj/current/public;

    server_name ....;
    ssl_certificate ...;
    ssl_certificate_key ...;

    client_max_body_size 200M;

    add_header Strict-Transport-Security "max-age=63072000;";

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_intercept_errors off;

    index index.php index.html;

    location ~* \.(?:pdf|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|ttf|eot)$ {
        try_files $uri /index.php?$args;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        add_header Access-Control-Allow-Origin * always;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_read_timeout 600;
        fastcgi_param PHP_VALUE "max_execution_time=600";
    }
}

server {
    listen 443 ssl http2;
    root /var/www/my-proj/current/public;

    server_name ....;
    ssl_certificate ;
    ssl_certificate_key ;

    client_max_body_size 200M;

    add_header Strict-Transport-Security "max-age=63072000;";

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_intercept_errors off;

    index index.php index.html;

    location ~* \.(?:pdf|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|ttf|eot)$ {
        try_files $uri /index.php?$args;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        add_header Access-Control-Allow-Origin * always;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_read_timeout 600;
        fastcgi_param PHP_VALUE "max_execution_time=600";
    }
}

server {
    listen 443 ssl http2;
    root /var/www/..../current/public;

    server_name ...;
    ssl_certificate ...;
    ssl_certificate_key ...;

    client_max_body_size 200M;

    add_header Strict-Transport-Security "max-age=63072000;";

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_intercept_errors off;

    index index.php index.html;

    location ~* \.(?:pdf|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js|woff|woff2|ttf|eot)$ {
        try_files $uri /index.php?$args;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
        add_header Access-Control-Allow-Origin * always;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
0 likes
0 replies

Please or to participate in this conversation.