Omar Shamali

FIX: Linux CWP PHP Upgrade Failure via PHP Switcher Caused By Full RAM

Author: Omar Shamali
Writing Date:

Most of the time the cause of PHP upgrade failure in a server is due to lack of memory (RAM).

In this post will fix the Issue while upgrading PHP version, specifically in Control Web Panel (CWP), for example from 7.4.X to 8.3.X.

Being the issue produced with CWP in hand, that does not mean its exclusive to it, I have read a lot of posts of servers that have different software and Linux versions and still getting the same error conclusion: not enough memory.

The error will be shown similar to below output from PHP upgrade log file:

cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make: *** [Makefile:916: ext/fileinfo/libmagic/apprentice.lo] Error 1

This applies on almost any type of servers, cloud, VPS, dedicated...etc, the most important thing is to get root access for SSH.

The solution is to have enough memory for the PHP upgrade, which is around 1.5-2.0 GB (this is an estimation based on experience not on real references).

Simple solutions:

  1. Empty the memory, by restarting the server or by a tool (usually available within the management software if you have one such as CWP).
  2. Temporary resealing the server from your provider if applicable (usually not free, you can try the next solution costs nothing).
  3. Using Swap memory, the quick explanation is: take part of disk space and use it as RAM when it drops low.

For the option #3,  Swap on Linux, you can search for a tutorial that is specified to your environment. But for Linux with CWP, I used this tutorial from AZDIGI.

After successful setup of Swap, CWP dashboard will look like below screenshot:

fix-linux-cwp-php-upgrade-failure-via-php-switcher-caused-full-ram screenshot-2024-05-15-at-7-53-42-pm-png

Note: This was tested on Almalinux.