- Bare Metal
- Bare Metal Cloud
- Big Data Benchmarks
- Big Data Experts Interviews
- Big Data Technologies
- Big Data Use Cases
- Big Data Week
- Data Lake as a Service
- Dedicated Servers
- Online Retail
- People of Bigstep
- Performance for Big Data Apps
- Press Corner
- Tech Trends
- What is Big Data
How to Tweak System PHP Values in WHM
Whether you have a Linux bare metal server or a VPS, you might have to adjust WHM system php settings for your particular use case. This can be rather confusing since the system uses its own separate php version rather than one of those available to normal users.
Adjusting php values such as the memory limit or the maximum upload size is a trivial task in cPanel and most users know how to modify them with a few clicks. However, there are cases when these changes seem to have no effect on services such as phpMyAdmin or Composer. These errors can only be fixed from WHM, so let’s discuss a few examples in this short tutorial.
The version of phpMyAdmin that is included in every cPanel account can sometimes run into php errors, especially when handling large databases or SQL dumps. Changing the php settings from cPanel will not solve these issues, because the service doesn’t use the same php version as the user, but rather the system one of cPanel services.
If you want to change the system php version, this can only be done from WHM. Navigate to Home > Software > MultiPHP Manager and click on the Edit button under System PHP Version.
We recommend using the latest available php for WHM services, for a faster load time. However, be careful when modifying this setting, since the system php will be applied to any domains that do not have a specific version configured and are set to inherit the system value.
Changing the system php settings is not very intuitive, since this is not done from the usual WHM menus, but rather from the Tweak Settings interface. Navigate to Home > Server Configuration > Tweak Settings, then click on the PHP tab. There are four important php values that you can modify here:
cPanel PHP max execution time has a default and minimum value of 90 seconds and can be increased or set to -1 (unlimited), in order to allow the execution of long queries or large imports.
cPanel PHP max POST size (default 55 MB) and cPanel PHP max upload size (default 50 MB) should be changed at the same time if you need to upload large files to phpMyAdmin. The maximum value allowed here is 2047 MB.
Finally, you can choose between ioncube and sourceguardian as the cPanel PHP loader. These loaders are required by some software, such as Softaculous.
The actual system php memory limit can be changed from the System tab of the Tweak Settings interface.
It defaults to a minimum of 4096 MB and can be increased or set to Unlimited. Keep in mind that this limit has a practical purpose and is intended to prevent a process from using all of the system memory, so don’t increase it unless needed.
Composer php errors
A common error encountered when using composer from the command line is similar to this one:
mmap() failed:  Cannot allocate memory
This error message can be quite misleading, since it can’t be fixed by increasing the local or system php memory limit.
The error is actually caused by a WHM security feature that must be deactivated in order for composer to run normally. From the main WHM menu, go to Home > Security Center > Shell Fork Bomb Protection, and then click on Disable Protection. Keep in mind that you will have to logout and log back in the cli session before the change is applied.
These are the most common errors related to system php settings in cPanel, but there are of course other rare situations when tweaks are required. If you encounter such issues, feel free to ask for advice from our system administrators. And if you’re in need of a dedicated bare metal server, managed or unmanaged, you know where to ask!
About the Author
Dragos Baldescu is a Level 2 Technical Support Engineer at Bigstep, passionate about Linux and testing out new technologies and solutions.