Changing PHP settings: memory_limit, upload size and execution time

Which PHP settings people usually need to change, how to find out which ones your account can adjust, and why server limits act as ceilings.

Guide2 min readLast updated
On this page
  1. The settings people usually want
  2. Finding out what you can change
  3. Server limits are ceilings
  4. Before raising a limit
  5. If it doesn’t work

Some PHP settings can be adjusted per account on shared hosting; others are fixed for everyone’s security and stability. This guide shows how to check what applies, rather than promising particular values.

The settings people usually want

SettingControlsTypical symptom when too low
memory_limitMemory one request may use“Allowed memory size exhausted”
upload_max_filesizeLargest single uploaded fileUpload rejected
post_max_sizeLargest total form submissionUpload fails silently; must be ≥ upload size
max_execution_timeSeconds a script may run“Maximum execution time exceeded”
max_input_varsNumber of form fields acceptedMenus or settings pages don’t fully save

Finding out what you can change

  1. Look in DirectAdmin for a PHP settings or configuration option near the PHP version selector, or search “PHP” in the panel search. If present, it shows which directives your account can edit.
  2. Try a .user.ini file. Some server setups read a .user.ini in public_html:
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120

Changes can take a few minutes to apply.

  1. Confirm the result with a phpinfo file — check the Local Value column. How to check which PHP version your site is using

Server limits are ceilings

If the server caps a value, asking for more has no effect, silently. If your change doesn’t show in phpinfo, that’s why.

Before raising a limit

Ask why it’s being hit. Well-behaved sites rarely need huge limits. A limit reached repeatedly usually points to one plugin or process doing too much at once. “Allowed memory size exhausted” PHP error

Choosing a host for a PHP project? Every Traxio account runs PHP 7.4 to 8.4 with a MySQL database: see PHP and MySQL hosting, £0.99 a month.

If it doesn’t work

These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going