PHP is a programming language that provides optimal conditions for web applications. It is used by almost all Content Management Systems (CMS) such as TYPO3, WordPress, Joomla, or Contao, and by e-commerce platforms like Shopware and Magento. Essential settings are stored in a central configuration file called php.ini, which can often be edited through the CMS or directly via a text editor. An important parameter in this file is the PHP Memory Limit.
What exactly is the PHP Memory Limit and how can it be adjusted individually is explained in the following article:
How does PHP work?
PHP belongs to the so-called scripting languages. This means that programs are written as easily understandable code. Subsequently, an interpreter takes over the processing by reading a program line by line and executing the instructions according to its php.ini. CMS such as Magento, WordPress, or Joomla consist of a variety of scripts, each performing a specific task. They are loaded into a specific area of the memory, which is limited by the PHP Memory Limit and can be increased individually. The PHP scripts are used to create a webpage in HTML format from various sources such as a database, external files, and special style sheets - the css files. This is complemented by client-side scripts written in other languages like Java or JavaScript, enabling interactive features such as games or animated menus. Suitable web hosting packages with PHP support can be found in the PHP Web Hosting Comparison.
What is the PHP Memory Limit and what is its purpose?
As mentioned earlier, PHP reserves a portion of the memory to store and execute scripts. The size of this area is defined by the PHP Memory Limit in the php.ini. The limitation imposed by the PHP Memory Limit protects a computer from being affected in its performance by poor or faulty programming. A simple example of this would be a loop that creates and stores a variable whose name and value increase by 1 with each iteration. Without a PHP Memory Limit in the php.ini, this would lead to the entire memory being occupied by this one loop over time. As a result, the loading times increase, and in some cases, the operating system itself may become unstable due to a lack of memory for its data.
How high should a PHP Memory Limit be in production operation?
In web hosting, the standard size of the PHP Memory Limit is usually between 32 MB and 64 MB. This is sufficient for the basic installation of a CMS like WordPress, Contao, Joomla, or TYPO3 and allows for stable operation. Complex plugins, large databases, or many extensions require more memory for the scripts and their data. In this case, instead of a webpage, PHP outputs an error message, which may state the following:
Fatal error: Allowed memory size of XXXXXX bytes exhausted (tried to allocate XXXXXX bytes) in /var/www/html/skript.php
In this case, it is necessary to increase the PHP Memory Limit so that the interpreter has sufficient temporary memory available for the execution of all scripts. Recommended limits for a CMS range between 32 MB (WordPress) and 256 MB (Shopware) - more than 512 MB are rarely necessary and often indicate programming issues.
Find web hosting here with at least 128MB PHP Memory Limit: