PHP (Hypertext Preprocessor) is an open-source scripting language that is especially suited for web development. It runs on the server side, meaning it processes code on the web server before sending it to the client (browser). WordPress is built on PHP; therefore, it’s essential for WordPress sites. PHP enables your WordPress site to:
When a visitor visits an uncached page or performs an action on a page (e.g., adding something to a cart, submitting a form, etc.), the following process occurs:
If
your site does not use caching or is not optimized, PHP threads may be
busy for longer, which can degrade performance and lead to timeouts or
503 and 504 errors when visitors access your site. For information about
how to check the PHP performance and how to optimize your PHP threads,
refer to PHP performance.
PHP workers are individual PHP processes responsible for handling incoming requests to your website. Each worker processes one request at a time, meaning if you have four workers, only four requests can be processed simultaneously.
Once a PHP worker finishes processing a request (e.g., rendering a page or fetching data from a database), it becomes free to handle the next one.
PHP workers really come into play when a site doesn’t or can’t cache most of its content. The more dynamic a website is, the more PHP workers it will likely need. Cached content doesn’t require PHP workers; they’re really only needed when the site needs to query the database to get or change information. An optimized site handles requests quickly, freeing up PHP workers for the next request in the queue.
For information about how to optimize your PHP workers, refer to PHP performance.
The
following table shows the default PHP pool, thread count, and memory
per thread that are included by default in each plan at Hivium:
Plan | PHP Workers per site | Memory per worker |
Startup | 4 | 512MB |
Professional | 6 | 512MB |
Growth | 8 | 512MB |
Scale | 10 | 512MB |
Agency - Startup | 4 | 512MB |
Agency - Professional | 6 | 512MB |
Agency - Growth | 8 | 512MB |
Agency - Scale | 10 | 512MB |
The PHP memory limit defines the maximum amount of memory (RAM) each PHP worker can use while processing a request.
This limit is crucial because PHP scripts (especially in WordPress) often need to handle memory-intensive tasks such as large database queries, media uploads, or complex calculations.
If a script exceeds the
set memory limit, it results in an error (e.g., “Allowed memory size
exhausted”). This prevents one script from consuming excessive server
resources.
Hivium’s default memory limit is 512MB, which is more than enough for most WordPress plugins and sites. This limit exists to prevent PHP scripts from consuming excessive memory. If you set the limit too high, a misconfigured or broken script can cause serious issues by using up too much memory.
You can change a site’s PHP memory limit within Website > sitename > Advanced > Developer Tools > php.ini editor.
The number of PHP workers should not be confused with the PHP memory limit. PHP workers are individual PHP processes that handle incoming web requests, whereas the PHP memory limit specifies the maximum amount of memory (RAM) a single PHP script can use during execution.
PHP workers manage concurrency by processing multiple requests simultaneously, whereas the PHP memory limit manages resource allocation by restricting the memory usage of individual scripts. This prevents any single script from using all the server’s available memory.
PHP
memory limits are important for scripts requiring substantial memory,
such as those performing large database queries, handling large file
uploads, or executing complex calculations. If you encounter memory
limit errors on your site, increasing the number of PHP workers won’t
resolve this issue. Instead, you should increase the memory per thread as stated above.
When adding PHP workers, CPU and RAM resources must be taken into account. If you increase the number of PHP workers, but the server needs more CPU and RAM to support those workers, this will create a bottleneck because the requests won’t be handled efficiently. If you require more PHP workers, you can connect with our Sales Team.
As a Managed WordPress service, Hivium has the optimal PHP settings configured to work best with WordPress sites. If you have specific PHP requirements, feel free to reach out to our Support Team to discuss your needs.
Hivium offers PHP 7.4, 8.0, 8.1, 8.2, 8.3 and 8.4. These are the default settings for PHP: