Frequently asked questions

Back
Keyword:  

Which resource limits do you have for PHP?

Below you will find a table of our current default resource limitations for PHP, and what maximum values we allow.

Please note that adjusting the values above these limits will have no effect.

PHP limits

Configuration settingDefaultMax limit
max_execution_time 90 300
max_input_time 90 90
memory_limit 256M 512M
max_input_vars 2500 5000
post_max_size 128M 128M
upload_max_filesize 128M 128M

Can I increase the limits?

Customers with a concrete need for higher limits, may increase these manually, up to but not beyond the limits listed above in the column Max limits.

These changes may be added one by one in a file named .user.ini, which is usually placed in the document root for your web hosting (normally the www folder).

Example

.user.ini for higher max_input_vars and max_execution_time:

max_execution_time = 90
max_input_vars = 2500

File uploads

File uploads are also limited by the ModSecurity rules. These cannot be overridden.


PHP and uWSGI

PHP is configured with uWSGI based on the "emperor-vassal" model. A webhotel's PHP is served by a vassal. Each virtualhost starts with 1 vassal, and may use up to 4 vassals simultaneously. This makes PHP more efficient and limits the resources used, and reduces the risk of overload.


System limits

DescriptionLevel
Max CPU time per process 60 sec
Max real memory usage per process 600 MB
Max processes per user 25

If these limits are exceeded, you'll most likely see error code 500 "Internal Server Error". These limits cannot easily be handled by PHP or CGI themselves.

Additionally, ImageMagick is limited to use approximately 500 MB for pixel and rendering cache. The combined limits are sufficient to permit WordPress import of 24 Mpx JPEGs and somewhat larger PNGs.


What does this mean, and why?

  • CPU-time is a more generous limit than wall clock time, it's how long the process can run with 100% CPU usage. The limit is high because some maintenance processes in e.g. WordPress take more time than normal webpages, up to 20-30 seconds. Web software should never use anywhere near this long to serve a webpage.
  • Real memory usage is considerably higher for PHP than what PHP itself keeps track of, which means we need to permit more than 129/256 MB. This doesn't mean that it's okay for you to take advantage of this, please keep your memory footprint low.
  • Processes per user equals the number of concurrent PHP scripts/programs, or PHP vassals, plus programs started by PHP. Assuming a normal runtime of 5 seconds, and sensibly configured webpages, this limits permits several thousand visitors an hour.

If software exceeds the limits for CPU time or real memory usage, it is out of resources, and terminated immediately by the OS. This can principally be detected by PHP itself, or the CGI software, but in practice, we find that this is not handled well. This is why all these limits are greater than what a website strictly needs to run properly, and more than the limits imposed by PHP itself.

If a 26th concurrent process tries to start, it will not start. Any processes currently running are unaffected by the process limit.

Can I increase the system limits?

No, these are hard limits. If you need more resources, then your needs exceed those that can be provided with a webhotel. Consider a dedicated server or virtual private server (VPS) instead.


See also:

© 2024 Domeneshop AS · About us · Terms · Privacy policy