• Hi,
    I built a web application that takes all the products in the site (Woocommerce-based), converts them to PDF files, and put the files in a directory under wp-content/uploads.
    I did it with foreach that loops though all the products, the loop is executed by pressing a button.
    The problem is that it’s a complicated action (conver html to pdf, and download the file) and I have like 100 products. So when I triggers the loop, after waiting of like 30 seconds, I get “502
    The page request was canceled because it took too long to complete”.
    (24 products, does download in that time).
    I know it’s more like programmatic php question rather than a WordPress one, but still, does anybody know a way to cancel php from “aborting” after x time?

    Thanks in advance

Viewing 1 replies (of 1 total)
  • This is something that is controlled on the server level. It is a safety measure done to ensure the servers are able to serve the maximum amount of requests without waiting for other requests to finish. You will have to talk with your host to see what they can do for you in regards to upping that time. If you are on a shared server, it is unlikely they will up the timeout limit by too much but certainly worth a support ticket or phone call.

Viewing 1 replies (of 1 total)
  • The topic ‘Getting 502 when performing a loop’ is closed to new replies.