> ## Documentation Index
> Fetch the complete documentation index at: https://kb.stablepoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to increase your PHP maximum execution time

PHP's max\_execution\_time limits how long a script may run before the server stops it (default is typically 30 seconds). Long-running tasks — large imports, backups, migrations — sometimes need more.

## Method 1: MultiPHP INI Editor

1. Log in to cPanel.
2. In the **Software** section, click **MultiPHP INI Editor**.
3. Select your domain.
4. In **Basic Mode**, find **max\_execution\_time** and enter a higher value (e.g. 300 for five minutes).
5. Click **Apply**.

## Method 2: PHP Selector options

If your server uses the CloudLinux PHP Selector:

1. In cPanel, click **Select PHP Version** → **Options**.
2. Find **max\_execution\_time** and set the value.

## Method 3: .htaccess

On servers where PHP runs in a mode that allows it, you can add this to your *.htaccess*:

```text theme={null}
php_value max_execution_time 300
```

<Note>
  If adding php\_value lines to .htaccess causes a 500 error, your PHP handler doesn't accept them — remove the line and use Method 1 or 2 instead.
</Note>

## Method 4: In the script

For a single script:

```php theme={null}
<?php
ini_set('max_execution_time', 300);
```

## Related limits

Long-running tasks often hit other limits at the same time. Consider raising these too:

* **memory\_limit** — memory available to the script (e.g. 256M)
* **upload\_max\_filesize** and **post\_max\_size** — for large file uploads
* **max\_input\_time** — time allowed to parse input data

<Warning>
  Raise limits to what the task genuinely needs, not to extreme values. A script that needs 30+ minutes is usually better run as a [cron job](/web-hosting/performance/cron-jobs) or from the [command line over SSH](/web-hosting/files-and-access/secure-shell-ssh-overview), where web-request time limits don't apply.
</Warning>
