{kun´ēzē}
 
(Reading time: 8 - 16 minutes)
24Jun2023

Absurdly wrong PHP settings that people use … and wonder why they have problems!

Information
3206 hits Updated: 26 June 2023 Blog

Article Index

Everything is “fine” … except it isn’t

Four important PHP settings

Max. input time

Max. Upload Size

Max. POST Size

Memory Limit

You can create Joomla! websites just a­bout any­where; there are thou­sands of com­mercial web­hosting ser­vices to showcase your work to the world.  You can also host your websites using your own personal computer (before put­ting them “out there” on the world wide web).  So why do so many seem to have people have trouble maintaining their Joomla! websites?

There are many products you can install on your PC—de­pen­ding on the operating system—such as Wampserver, XAMPP, MAMP, LAMP.

See also Technical Requirements; for a com­pre­hen­sive list of additional PHP environmental settings used with Joomla, please see Optional Technical Requirements for J! 3.x or Optional Technical Requirements for J! 4.x (whichever applies to your particular circumstances).  Note that some of these “optional” requirements are actually needed!

I’ve lost track of the number of times I’ve seen people begging for help on technical forums, saying, “I created a J! website and everything was fine until I tried to add a new extension (or update the software … or change something).  What could possibly be wrong?”  When we find out more about their hosting environment we discover that it’s a shambles.  Everything was not “fine” to begin with; if they’d made a couple of small changes to the hosting environment they wouldn’t have the mess that they now have.  Does this sound like you?  Would you like to know about four important PHP settings that can mean the difference between happy webcrafting and tear-your-hair-out frustration and misery?  If this sounds like you this article may just be a life-saver.

I’ve written before about a few of the important things people can do to maintain their Joomla! websites.  Let’s summarise a few important PHP settings that determine whether you can maintain your J! website or whether you can’t.  The following table lists those settings (and my recommendations for how you should use them):

PHP settings and Joomla

Next up, “Memory Limit = -1” …


Memory Limit = -1

What does Memory Limit = -1 mean?

The PHP memory limit should be set to a specific number; it should not be left “undefined” or set to a ridiculously large value (e.g. greater than 4Gb).  If the memory limit is undefined then J! will encounter problems (particularly when running the Joomla! Update component).

What is the value of the PHP Memory Limit used by your J! website

There are several ways to obtain this information:

  • Go to System » System Information » PHP Settings and search for “Memory Limit”.
  • If you have access to you web host’s cPanel (or something similar with a PC-hosted AMP stack like Wampserver) look for PHP settings with the version of PHP you’re using.
  • Run the Forum Post Assistant reporting tool.

Remedy

Set or change the value of Memory Limit to a “reasonable” value. As a minimum, I recommend trying 512M as a “reasonable” value.  For the reliable operation of a J! 4.x website, do not use a value less than 256M (there's no good reason to be a miser here); while it normally doesn’t cost anything to increase the memory limit over 512M, don’t go “overboard” and set a ridiculously high value (e.g. greater than 4096M).

Setting the ideal value for Memory Limit may require some trial and error. There is no one-size-fits-all solution so you have to be patient and experiment.  The value of Memory Limit depends on the number of concurrent user sessions you have running, what third-party extensions you have installed, the effective performance of the machine that is hosting your website, and whether the memory allocated by PHP to your website is dedicated to the site or whether the value is pooled (i.e. shared between other websites on the server).

Known problems

An “undefined” memory limit (i.e. Memory Limit = -1) is known to cause problems with Joomla.  My advice is to check the PHP setting for Memory Limit and set it, or change it, to a specific value.  If more people carried out this simple check then we would probably see fewer questions about the same kinds of problems that we often see.

Next up, “Max. input time = -1” …


Memory input time = -1

What does Max. input time = -1 mean?

The PHP Max. input time should be set to a specific number; it should not be left “undefined” or set to a ridiculously large value (e.g. greater than 120) and it should never be set to 0!  If the Max. input time is undefined then J! will encounter problems (particularly when running the Joomla! Update component).

How to find the value of the PHP Max. input time used by your J! website

There are several ways to obtain this information:

  • Go to System » System Information » PHP Settings and search for “Max. input time”.
  • If you have access to you web host's cPanel (or something similar with a PC-hosted AMP stack like Wampserver) look for PHP settings with the version of PHP you're using.
  • Run the Forum Post Assistant reporting tool.

Remedy

Set or change the value of Max. input time to a “reasonable” value; I recommend 60 as a something sensible to begin with.  Don't go “overboard” and set a ridiculously high value (e.g. greater than 120) otherwise this can enable rogue scripts or malware to clog your server’s performance; it could affect not only your website but other websites hosted on the server.

Setting a sensible value for Max. input time can require some trial and error and you may have to experiment.  The main point is to set a value that allows you to manage your Joomla website and carry out everyday maintenance activities such as updating extensions or updating the core CMS.

Known problems

An “undefined” Max. input time (i.e. Max. input time = -1) is known to cause problems with Joomla.  My advice is to check the PHP setting for Max. input time and set it (or change it) to a specific value.  If more people carried out this simple check then we would probably see fewer questions about the same kinds of problems that we often see.

Next up, “Max. upload size = 2M; Max. POST size = 8M” …


Max. upload size = 2M; Max. POST size = 8M

What do Max. upload size and Max. POST size mean?

Max. upload size corresponds to the PHP setting upload_max_filesize; Max. POST size corresponds to the PHP setting post_max_size.

The online PHP guide says

upload_max_filesize

  • The maximum size of an uploaded file.

and

post_max_size

  • Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.

Typically, on new installations of PC-hosted web servers (e.g. Wampserver, XAMPP, LAMP and the like) and some commercial web servers, upload_max_filesize has an initial value of 2M and post_max_size is initially 8M.  While these initial values may be sufficient to allow the new installations of J! to be done, they are not sufficiently large enough to allow those J! websites to be updated later or large enough to allow some third-party extensions to be installed.

The crunch comes when it's time to update the version of J! that you're currently using.

How to find the values of Max. upload size and Max. POST size used by your J! website

There are several ways to obtain this information:

  • Go to System » System Information » PHP Settings and search for and “Upload Max Filesize” and “Post Max Size”.
  • If you have access to you web host's cPanel (or something similar with a PC-hosted AMP stack like Wampserver) look for PHP settings with the version of PHP you're using.
  • Run the Forum Post Assistant reporting tool.

Remedy

Set or change Max. upload size and Max. POST size to “reasonable” values; I recommend setting upload_max_filesize to 64M and post_max_size twice that value (i.e. 128M) as a something sensible to begin with. Don't go "overboard" and set a ridiculously high value (e.g. greater than PHP's memory_limit).

Setting ideal values for Max. upload size and Max. POST size may require some trial and error and you may have to experiment.  I would suggest that post_max_size should be set to be no more than half the value of memory_limit and upload_max_filesize should be set to half the value of post_max_size.   The main point is to set values that allow you to manage your Joomla website and carry out everyday maintenance activities such as updating extensions or updating the core CMS.

Known problems

J! 4.x update packages are quite large (and getting bigger all the time); at the time of writing, the update package [ZIP format] for J! 4.3.2 is 29.3 Mb. Therefore, Max. upload size must be greater than this number and, correspondingly, Max. POST size must also be increased.  Likewise, some third-party extension installations/updates can be big, too.

While it's possible to run with Max. upload size set to 32M, there's no guarantee that this value will accommodate future updates of Joomla.

If these matters did not cause problems I would not have written this article.  My advice is to check the PHP settings for upload_max_filesize and post_max_size and set them (or change them) accordingly.  If more people carried out these simple checks then we would probably see fewer questions about the same kinds of problems that we often see.

About the author:

has worked in the information technology industry since 1971 and, since retiring from the workforce in 2007, is a website hobbyist specialising in Joomla, a former member of the Kunena project for more than 8 years and contributor on The Joomla Forum™. The opinions expressed in this article are entirely those of the author. View his profile here.


No thoughts on “Absurdly wrong PHP settings that people use … and wonder why they have problems!”

User Rating: 4 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Inactive
 
Trending now