PHP limits for Mautic: memory, execution time and uploads

Mautic depends on PHP limits for uploads, long installs and heavy jobs. This page covers which settings matter, where to change them, and how to prevent limit-related errors.

On this page

Why PHP limits cause Mautic errors and when to tune them

This section explains why an install, a contact import or a file upload can fail with a PHP error on a self-hosted Mautic server, and when changing PHP settings is the right fix. Mautic is a marketing automation application written in PHP on the Symfony framework, so its behavior depends on how the PHP runtime on your server is configured. The project states that Mautic should not be installed on shared hosting and recommends a VPS or dedicated server instead, because those environments usually let you control PHP settings. On a VPS or dedicated server, the limits that matter most for Mautic are upload size, script execution time and memory, and each one is set in the PHP configuration that your web server and command-line PHP read.

The execution time limit deserves attention during installation. The page you are reading specifies a max_execution_time of at least 240 seconds for installs, so a lower value can stop the installer partway through database setup and leave the instance half built. Before you run the installer, check the value that the web server's PHP handler uses and the value the command-line PHP uses, because the two can differ and the web installer and command-line tasks read different configuration. Confirm the exact values for your PHP version against the Mautic requirements page and the installation documentation for your release line.

Treat limit errors as a signal to check configuration, not as a reason to raise every value. Each limit protects the server from runaway requests, so the right change is the smallest one that clears the failing task, such as a large contact import or a media upload. Record the value you changed, the PHP service you restarted and the task that now succeeds, so the change can be reviewed during upgrades and audits. When you plan the server, ask your provider or internal platform team to confirm where each setting lives on your operating system, since package layouts differ, and to include these checks in the build and handover documentation.

Which PHP limit to change and when each setting fits

This table compares the PHP settings that cause Mautic errors, the symptom each one addresses, the request context it governs and the cost of raising it. Read each row against the error you see, and change only the setting that matches it.

SettingSymptom it addressesContext and trade-off of raising it
upload_max_filesizeContact imports, asset or image uploads fail with a size error or an empty responseWeb request only. Larger values let users push bigger files through PHP, which uses more temporary disk and memory during handling.
post_max_sizeLarge form submissions or import uploads are silently truncated, even after upload_max_filesize is raisedWeb request only. Must be equal to or larger than upload_max_filesize, so raise it together with that setting.
max_execution_timeLong imports, campaign rebuilds or installer steps stop partway with a timeout errorApplies to web requests and, by default, CLI runs differ. Install and bulk tasks need the higher value, but long requests tie up PHP-FPM workers for longer.
memory_limitFatal errors reporting allowed memory size exhausted during imports, segment rebuilds or report generationApplies to web and CLI. Higher values allow larger jobs to finish, but a single process can consume more RAM, which reduces how many workers fit on the server.
max_input_timeLarge POST requests time out while PHP is still reading inputWeb request only. Usually matches the pace of slow uploads on the network; raising it has little effect on background jobs.
Where it lives: php.iniApplies to every PHP SAPI that loads the file unless a more specific file overrides itFind the active file with the phpinfo output or php --ini. Restart PHP-FPM or the web server after editing so changes take effect.
Where it lives: PHP-FPM poolPer-pool overrides for web requests served through that poolSet with php_admin_value or php_value in the pool file. Overrides here win over php.ini for that pool only, which can make web and CLI values differ.
Where it lives: CLI php.iniMautic cron jobs, the broadcasts command and messenger consumers run hereConfirm which php.ini the cron user loads. The web and CLI values must match, or background jobs fail under limits the web UI never hits.

Where to change PHP limits for web, CLI and FPM

When Apache loads PHP as an module, requests to Mautic run inside the Apache process and read the php.ini that the Apache PHP module was built to use. Changes made to the CLI php.ini do not affect these web requests, so an upload that fails in the browser can still succeed from the command line, and the reverse is also true. Look for the Apache PHP module configuration file on your distribution, which is commonly a separate file under the Apache configuration directory, and confirm the exact paths with your distribution's packaging documentation.

  • Find the active file: Create a temporary PHP page that calls phpinfo() under the Mautic host, read the Loaded Configuration File line, and delete the page once you have the answer.
  • Set the three limits: Adjust upload_max_filesize, post_max_size, max_execution_time and memory_limit in that file, keeping post_max_size at least as large as the upload limit.
  • Restart Apache: Reload or restart the Apache service after saving, because mod_php does not re-read php.ini on each request.
  • Check for overrides: Look for .htaccess or virtual host lines that set php_value directives, since these override the php.ini values for that directory.
  • Verify from the browser: Reload the phpinfo page and confirm the new values before removing it.

Confirm the active file and the restart command for your distribution before editing, and keep the phpinfo page off any public path.

Set and verify PHP limits before installing Mautic

This sequence confirms the PHP version for your Mautic release, raises the upload, execution time and memory limits in the correct php.ini files, and proves the new values are active for both the web and command-line runtimes before the installer runs.

  1. Confirm the PHP version for your release

    Check the Mautic requirements page for the release you plan to install, then confirm that the PHP version on the server is one it supports. Mautic 7.0 requires PHP 8.2, 8.3, 8.4 or 8.5, so an older runtime must be upgraded before any limit changes matter. Run php -v on the server and record the version. The step is done when the version appears in your install record and matches the supported list for the release you chose.

  2. Locate the active php.ini files

    Run php --ini to find the configuration file the command-line PHP uses, and create a phpinfo page temporarily under the web root to find the file the web server uses. The two files are often different, especially with PHP-FPM or multiple PHP versions installed side by side. Write down both paths. The step is done when you can name the exact file each runtime reads, with the version it belongs to.

  3. Set upload, post and execution limits

    In each active php.ini, set upload_max_filesize and post_max_size so that contact imports and asset uploads fit within your planned file sizes, and set max_execution_time to at least 240 seconds for installs as the Mautic guidance calls for. Post size should be at least as large as the upload size. Confirm the exact values with your own import plans, since large contact files usually need the upload limits raised further. The step is done when the edited file contains the new values and a backup of the original exists.

  4. Set the memory limit

    Set memory_limit in the same php.ini files to a value your Mautic version and expected workload need, and confirm the figure against the Mautic installation and requirements documentation for your release. Do not set it so high that a few concurrent workers can exhaust server memory, because cron jobs and queue consumers also run PHP. Ask your team to record the chosen value and the reason for it. The step is done when memory_limit is set in both the web and CLI configurations.

  5. Reload PHP-FPM or Apache

    Restart or reload the service that serves PHP so the new settings take effect. With PHP-FPM, reload the FPM pool for the relevant PHP version. With mod_php under Apache, reload Apache. Command-line PHP reads its file on every run, so no service restart is needed for cron jobs. Check the service status afterward for errors. The step is done when the service reports healthy and no configuration test fails.

  6. Verify limits in web and CLI runtimes

    Load the temporary phpinfo page and confirm the four directives show the new values in the Loaded Configuration File section, then delete that page immediately because it exposes server details. Run php -i from the command line and check the same values appear for the CLI runtime. Compare the two outputs. The step is done when both runtimes report the expected values and the phpinfo file no longer exists on the server.

  7. Run the installer and a test import

    Start the Mautic web or command-line installer and confirm it completes without errors about execution time, memory or uploads. Then run a small test contact import using a file close to your real size and format. Watch the server logs during both runs. The step is done when the installer finishes, the test import completes without limit errors, and the observed values are recorded in your runbook for future upgrades.

Errors that point to a PHP limit

These failures look alike in the browser, but each usually traces to a different PHP directive or to a different layer of the stack. Start with the log that recorded the failure, then decide whether the PHP limit, the web server or the database is responsible. Raising values before reading logs can hide the actual fault and leave the next import or upload failing in the same way.

Installer timeouts

The web installer or a Composer-based setup stops partway through, often showing a blank page or a gateway error. A max_execution_time below the 240 seconds Mautic expects for installs is a common cause, and PHP writes a "Maximum execution time exceeded" fatal error to its error log when that happens. Check the PHP-FPM or Apache error log first. A 504 in the web server access log with no PHP fatal points to a proxy timeout instead, so raise the proxy value too.

Install docs

Blank pages or 500 errors on large imports

A contact import or a large segment action can exhaust memory_limit and stop with a blank page or an HTTP 500. The PHP error log records the message "Allowed memory size of N bytes exhausted" with the file and line where it happened. Confirm the number in that message against the value PHP actually loads. Split the file into smaller batches before raising memory, and check the database and web server logs for timeouts that can produce the same symptom.

Failed contact and asset uploads

Uploads fail when the file exceeds upload_max_filesize or when the whole request exceeds post_max_size, which must be at least as large as the upload limit. Nginx rejects oversized bodies before PHP runs, returning a 413 controlled by client_max_body_size, so PHP settings alone will not fix it. Check the web server access log for 413 responses and the PHP error log for upload warnings. Confirm the uploaded file size against each limit in the same request path.

Cron and queue jobs that stop mid-run

Segment updates, campaign triggers and the broadcasts command run from the command line, where PHP reads a separate php.ini from the web request. Memory limits often differ between the two, so a job can pass in the browser and fail under cron. Run php -i as the web server user to see which configuration file loads. Also check the cron output file and the messenger consumer log, because a process killed by the operating system leaves no PHP fatal error at all.

Changes that do not take effect

Edited values often appear to do nothing because the server loads a different php.ini than the one changed. Apache with mod_php, PHP-FPM pools and the CLI each can read their own file, and PHP-FPM must be reloaded after an edit. Ask the server which file is loaded and confirm each directive with a temporary phpinfo() page, removed afterward. Record the final values in your deployment notes so the next change starts from a known state.

Keeping PHP limits right after upgrades and server changes

A PHP upgrade can silently change which php.ini applies, so the limits you set for Mautic may not be the limits your web requests and cron jobs actually use. Mautic release lines list the PHP versions they support, and the Mautic requirements page is the reference to check before any PHP change. Confirm the PHP version each release line supports against the current Mautic requirements before you upgrade PHP, and treat a PHP version change as a trigger to recheck every limit covered on this page, including upload_max_filesize, max_execution_time and memory_limit.

Keep the limits in version-controlled configuration rather than only on the server. Record the values per context, because the web SAPI (Apache or PHP-FPM) and the CLI often read different php.ini files and different pool settings. For each server, keep a short table that lists the file path, the value and the process that uses it, and compare php -i output from the CLI with a phpinfo check served through the web stack. Reapply and compare after operating system updates and PHP package updates, since package managers can replace or add configuration files without warning.

Use the release cadence as your recheck schedule. Mautic publishes monthly patch releases and minor releases every three months, so each of those is a natural point to confirm that limits still hold, that cron jobs still run within max_execution_time and that uploads still succeed. Ask your hosting or platform team to document who owns each check, and confirm with them how any change to php.ini or the PHP-FPM pool is tested on a staging copy before production.

Security and operational trade-offs of higher limits

Raising PHP limits solves a Mautic error but changes what an attacker, a runaway job or a misconfigured server can do. The cards below cover the checks that should travel with every limit change, so the fix stays contained.

Upload limits widen the file attack surface

A higher upload_max_filesize lets larger files reach Mautic's upload handlers, including imports and asset uploads. Pair the limit with server-side file type validation, so extensions and content are both checked, and keep uploads outside any directory the web server executes. Confirm which Mautic features accept uploads in your version before you raise the value.

Install docs

Memory limits can hide inefficient jobs

A high memory_limit often lets a heavy segment rebuild or campaign run finish when it should be fixed or split up. Track memory use per cron job and per worker, so growth shows up as a trend instead of a surprise. Set the value so one bad process cannot take the whole host's RAM.

Long execution times tie up workers

A high max_execution_time keeps a worker busy on one job for longer, which delays other queued messages and background tasks. Stagger your cron jobs as the Mautic docs advise, and monitor how long each command runs. If one job regularly hits its limit, investigate the job before adding more time.

Cron jobs docs

Keep display_errors off in production

Setting display_errors to on sends stack traces, file paths and database details to the browser, which helps an attacker map the application. Log errors to a file or your log platform instead, and confirm the setting in the PHP that runs under your web server and in the CLI used by cron. Check it again after each PHP upgrade.

Log and monitor every limit change

Record which php.ini or pool file changed, who changed it and why, so a later incident can be traced to a specific setting. Alert on PHP fatal errors, memory exhaustion messages and timeouts in the Mautic logs. Review the alerts after the change to confirm the fix held without masking a deeper problem.

Verify limits in each PHP context

Web requests, PHP-FPM pools and the CLI often read different configuration files, so a value that works in a browser can still fail in cron. Ask your team to check php -i for the CLI and the phpinfo output for the web context. Test an upload and a long command in both before you close the change.

PHP limit questions buyers ask before hiring help

How much effort does fixing a Mautic PHP limit take?

For a single server, changing a PHP limit is usually a small configuration edit, but the effort around it is what varies. The work includes confirming which PHP configuration Mautic actually loads, which can differ between the web server and the command-line interpreter, setting upload_max_filesize, memory_limit and max_execution_time in the right files, restarting the correct PHP service, and checking that cron and queue workers pick up the same values. Effort rises when limits are set in several places, when the server is managed by someone else, or when the errors have already caused failed imports, updates or campaign runs that need cleanup. Ask any partner to separate the diagnosis, the change and the verification in its quote.

Can our internal admin change Mautic PHP limits without outside help?

Often yes, if the admin has root or sudo access to the server, knows which PHP version and SAPI Mautic runs under, and can read the Mautic and web server logs. The Mautic project's requirements page lists the PHP versions each release supports, so the admin should first confirm the installed version against the release line in use. The risk is in the details: the same setting can be applied to Apache or PHP-FPM but not to the command-line PHP that runs cron, so imports may still fail in the background. An internal admin who has never traced a failed background job will usually take longer than someone who has done it before, and should record each change so it can be reversed.

What does the work need from our team?

A partner or internal engineer typically needs four things: administrative access to the web server and PHP configuration on each affected host, read access to the Mautic logs and PHP error logs, a list of the operations that fail (imports, uploads, campaign runs, updates), and a change window that avoids active sends and imports. Expect to provide the current PHP version, the php.ini locations reported by the server, and the exact error text. Confirm with your change board whether PHP restarts count as a standard or normal change, and whether a staging copy of the instance exists for testing the new values before production.

How long does a PHP limit fix take when several environments are affected?

Duration depends mainly on how many environments and PHP runtimes are involved, not on the size of the change itself. A single production server with one PHP configuration is the simplest case. Each additional environment adds a diagnosis step, a change, a restart and a test of the same operation, and staging, production and any worker or cron hosts each need their own check. Shared or containerized setups add image or configuration management work. No duration is stated here because it depends on your environment and access arrangements; ask for a timeline tied to a written list of environments and operations to verify.

Can a partner stop these PHP limit errors from coming back?

A partner can reduce the chance of recurrence by making the settings explicit and monitored rather than relying on defaults. The practical steps are to record the required values in configuration management, verify the same values for the web and command-line PHP contexts, add a check that runs an upload and a long background job after each change or server rebuild, and alert on PHP and Mautic error logs. Recurrence can still happen after a PHP upgrade, a new server, or a Mautic release that raises requirements, so the plan should include a review step tied to the release cadence. Ongoing checks can be covered by a retainer if you want them maintained after the fix.

What should we ask for in a quote for this work?

Ask for a written scope that names each host, PHP runtime, and Mautic operation to be verified, along with the logs and access the partner will need from you. The quote should list the diagnosis, the configuration changes, the restarts, the verification tests, the handover notes and any post-fix monitoring as separate line items. Ask what is one-time and what recurs, such as monitoring or a retainer for future release reviews. Also ask how rollback will be handled if a new value causes problems, and who approves any change made on production systems.

Does a PHP limit fix also need a Mautic upgrade?

Not always. A limit fix can be done on the current installation as long as the PHP version is supported by the Mautic release in use. If the existing PHP version is outside what the release supports, the fix becomes a version upgrade with its own testing, which changes scope and risk. Check the Mautic releases page for the support dates of your release line and the Mautic requirements page for PHP compatibility before deciding. If support for your release is ending soon, ask the partner to plan the PHP change alongside a supported release path rather than as a separate patch.

How DeployOpen scopes PHP tuning for Mautic

DeployOpen is a Chainscore Labs company that plans, implements, hardens and documents self-hosted open-source platforms inside the client's own infrastructure, including cloud accounts, data centers and air-gapped networks. PHP limit work for Mautic is not sold as a standalone fix. It is scoped in writing as part of a fixed-scope Mautic deployment or as an item under an ongoing retainer, so the settings for upload_max_filesize, max_execution_time and memory_limit are agreed alongside the PHP version, extensions, web server and database they depend on. A written scope names which php.ini file or PHP-FPM pool is changed, which web server or CLI contexts must be checked, and who signs off on the values before they reach production.

The scope usually separates four pieces of work. The first is configuration: locating the active php.ini for both the web SAPI and the command-line SAPI, because Mautic's installer, cron jobs and broadcasts command can run under different limits from the browser. The second is verification: confirming the effective values with phpinfo() or php -i in each context, then reproducing the upload, import and long-running campaign actions that previously failed. The third is documentation, a short record of each value, the file that sets it, the reason for it and the test that proved it. The fourth is handover, where the client's operators receive that record and a short checklist for re-testing after PHP minor updates or Mautic upgrades. Ask for each of these four items to be named in the quote, since a fix that is configured but not verified or handed over tends to resurface at the next release.

Scope should also state what is out of the PHP tuning work. Changes to the Mautic application code, plugin fixes, queue worker design and database tuning are separate line items, and each affects the effort. Ask the vendor to confirm how they handle a limit that cannot be raised on your platform, for example because a managed host restricts memory_limit or a container image fixes its PHP configuration, and who approves a workaround such as chunked imports. Because DeployOpen does not publish a price list, the quote will follow the written scope, so the clearer the list of environments, PHP versions and Mautic release line in scope, the easier it is to compare proposals on a like-for-like basis.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.