A script timeout happens when a PHP page runs longer than something in the chain is willing to wait. On shared hosting that is common with imports, exports, reports and calls to slow outside services. This guide explains which limit you are hitting on Domain India hosting, why raising max_execution_time often changes nothing, and how to restructure long work so it finishes.
On our cPanel servers, nginx waits about 90 seconds for a page and then returns a 504 Gateway Timeout, whatever PHP's own limit says, so raising max_execution_time does not help beyond that. Make each web request short: process work in batches, add timeouts to outside calls, and fix slow queries. Move genuinely long jobs to a cron job (the shortest interval on our shared servers is every 4 minutes) or to a VPS where you set the timeouts yourself.
1. Which limit are you hitting?
A web request passes through several layers, and each has its own clock. The error you see tells you which one ran out.
| What you see | Which limit | Where it applies |
|---|---|---|
| 504 Gateway Timeout after about 90 seconds | nginx waiting for the page | cPanel servers |
| "Maximum execution time of N seconds exceeded" | PHP max_execution_time | Any server |
| Blank page or 500 with a fatal error in the log | PHP stopped by a limit or an error | Any server |
| 508 Resource Limit Is Reached | Too many PHP requests at once | Shared hosting accounts |
The measured values on our shared servers (24 September 2026):
- cPanel: nginx sits in front of Apache and waits about 90 seconds for a reply. The default PHP
max_execution_timeis 120 seconds, so on a web request the 90-second nginx limit is the one you hit first. - DirectAdmin: there is no nginx layer. The default PHP
max_execution_timein the server's PHP builds is 30 seconds. - Command-line PHP (cron jobs) has no execution time limit by default, but your plan's CPU and memory limits still apply.
2. Why raising max_execution_time rarely fixes it
On cPanel, a request that runs longer than about 90 seconds gets a 504 from nginx even if PHP would keep going. Raising max_execution_time to 300 changes nothing for the visitor, and the nginx timeout is server-wide, so it can't be changed for one account.
On DirectAdmin, raising the PHP limit may let a slow request finish, but it only hides the problem: a request that takes minutes also holds one of your account's PHP process slots the whole time. A few of those at once and visitors start getting 508 errors. See understanding hosting resource limits.
If you still need to change PHP settings for other reasons, cPanel's MultiPHP INI Editor is covered in how to edit php.ini in cPanel. Don't put php_value lines in .htaccess: PHP does not run as an Apache module on our servers, and those lines cause a 500 error.
3. Find the slow part
Measure before you change anything. Add timing to the script and write it to a log file outside your web folder:
<?php
$start = microtime(true);
error_log('job started', 3, __DIR__ . '/../logs/job.log');
$t = microtime(true);
$result = $db->query($sql);
error_log(sprintf("query took %.2fs\n", microtime(true) - $t), 3, __DIR__ . '/../logs/job.log');
error_log(sprintf("total %.2fs\n", microtime(true) - $start), 3, __DIR__ . '/../logs/job.log');Then read the error log for the time of the failure; see reviewing error logs in cPanel and DirectAdmin. The usual culprits are one slow query, one slow outside API call, or a loop over far more rows than you expected.
4. Make each request shorter
A batch loop that resumes where it stopped looks like this:
<?php
// process up to 200 pending rows per run, then stop
$rows = $db->query("SELECT id, email FROM jobs WHERE status = 'pending' ORDER BY id LIMIT 200");
foreach ($rows as $row) {
process($row);
$db->prepare("UPDATE jobs SET status = 'done' WHERE id = ?")->execute([$row['id']]);
}For outside calls with PHP's HTTP stream functions, set the timeout explicitly:
<?php
$ctx = stream_context_create(['http' => ['timeout' => 5]]);
$response = @file_get_contents('https://api.example.com/rates', false, $ctx);
if ($response === false) {
error_log('rates API did not answer in 5s');
}Several PHP functions are disabled on our shared servers, including exec, proc_open and, on most DirectAdmin sites, curl_exec. Check PHP disabled functions on shared hosting before you rely on one.
5. Move long work out of the browser
Some jobs are long by nature: a large import, a newsletter batch, a nightly report. Don't run them from a web page at all.
- Queue the work.When a user starts the job, write a row to a
jobstable with statuspendingand return a page straight away ("Your import has started"). - Process it from cron.A cron job picks up pending rows, works through a batch, and marks them done. Command-line PHP is not subject to the nginx timeout.
- Show progress.The web page reads the job's status from the table, so the user can check back.
On our cPanel and DirectAdmin shared servers, jobs set to run every 1, 2 or 3 minutes are changed to every 4 minutes automatically. Size each batch so it finishes well inside 4 minutes, or runs will overlap. Setup steps are in how to set up a cron job.
There is no Redis or other queue service on shared hosting, so a database table is the simplest queue. If the work must run continuously, needs a worker that stays running, or needs its own timeouts, it belongs on a VPS.
6. When a VPS is the right answer
On a VPS you control every layer, so you can set nginx's proxy_read_timeout, Apache's Timeout, PHP-FPM's request_terminate_timeout and PHP's max_execution_time to suit your application, and run queue workers under a process manager. Keep the front layer's timeout slightly longer than the one behind it, so errors come from PHP with a clear message rather than a bare 504.
A Domain India VPS is self-managed: you get full root access and look after the operating system, security and software yourself. Try the steps above first; most timeout problems are fixed by shorter requests, not bigger servers.
7. Where Domain India fits
For PHP sites that do their heavy work in batches and cron jobs, shared hosting is enough. For long-running workers and custom timeouts, choose a VPS.
- 50 GB NVMe SSD Storage
- 100 GB Monthly Bandwidth
- 5 Websites
- 50 Email Accounts
- 1 vCPU
- 2 GB DDR4 RAM
- 64 GB NVMe SSD Storage
- 2 TB Monthly Bandwidth
Cards show Domain India list prices on 19 September 2026, excluding 18% GST. For WordPress-specific errors, see resolving common gateway errors in WordPress.
Why do I get a 504 Gateway Timeout on cPanel hosting?
On Domain India cPanel servers, nginx waits about 90 seconds for a page. A request that runs longer returns a 504, even if PHP's own time limit is higher. Make the request shorter or move the work to a cron job.
Will increasing max_execution_time fix a 504 error?
No. The 90-second nginx limit on our cPanel servers applies whatever PHP's limit is, and it can't be changed for one account. Split the work into batches, add timeouts to outside calls, or run the job from cron.
What is the default max_execution_time on Domain India hosting?
On our cPanel servers the default is 120 seconds, although web requests are cut off by nginx after about 90 seconds. On our DirectAdmin server the default in the PHP builds is 30 seconds. Command-line PHP used by cron jobs has no time limit by default.
How do I run a script that takes longer than 90 seconds?
Run it from a cron job instead of a web page, or split it into batches that each finish quickly and resume where the last one stopped. Cron on our shared servers runs at most every 4 minutes. For work that must run continuously, use a VPS.
Can I run a queue worker on shared hosting?
Not as a permanent process. Shared hosting has no Redis and no long-running workers. Use a database table as a queue and process it in batches from cron, or move the worker to a VPS.
Can support raise the timeout for my account?
The nginx timeout on our cPanel servers is server-wide and is not changed per account. You can adjust PHP settings in your control panel, but the lasting fix is to make each request shorter or move long work to cron or a VPS.
Ready to fix it? Time the slow part, split the work into batches, and move long jobs to a cron job. If your application needs its own timeouts or workers, compare VPS plans, or open a support ticket with the page, the error and the time it happened.
Full root access on a KVM VPS, so you set the web server and PHP limits your application needs.
See VPS plans