Support

Akeeba Backup for Joomla!

#40418 Memory error - difficult to take at face value

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
Joomla! 4.4.3 Stable [ Pamoja
PHP version
8.1.27
Akeeba Backup version
9.8.5

Latest post by nicholas on Tuesday, 12 March 2024 02:40 CDT

kentmorrison

I can run manual backups from the Akeeba menu.

When the CRON job initializes, OR I try to run the backup command in a terminal

/usr/local/bin/ea-php81 /home/townof31/public_html/cli/joomla.php akeeba:backup:take

 

I get the following error in the terminal

Taking a backup with Akeeba Backup
==================================

Starting backup using profile #1.
---------------------------------

Last Tick : 2024-03-08 19:31:53 GMT+0000 (UTC)
Domain : init
Step :
Substep :
Progress : 0.00%
Memory used : 22.12 MB

// Peak memory used : 22.2 MB

// Backup loop exited after 0 seconds

[ERROR] Failed configuration check Q004: PHP memory_limit too low. Please refer to
https://www.akeeba.com/documentation/warnings/q004.html for more information and troubleshooting instructions.

root@vps72704 [~]#

 

The php Memory Limit is currently set to 2048M    HOW COULD THAT NOT BE ENOUGH MEMORY ?

 

I DO NOT HAVE A LOG FILE WITH THE ERROR IN IT - There are no log files for the failed backups, only for the successful backups done manually from the menu.

Please help ?

 

 

 

 

nicholas
Akeeba Staff
Manager

The message you get is correct. Your understanding of the subject is incomplete. I can help you, but please do refrain from using all caps in an entire sentence; it's the Internet-equivalent of yelling.

As a matter of fact, there is no single PHP configuration (php.ini). Each PHP SAPI (that is to say: CGI/FastCGI, Apache module, PHP-FPM, and CLI) has its own configuration. On top of that, there are SAPI-specific overrides. I am not making this up. This is what the official PHP documentation tells you in "The configuration file" section.

cPanel's EasyPHP configuration only applies to the web SAPIs: CGI/FastCGI, Apache module, or PHP-FPM depending on your server configuration. Changing the configuration there DOES NOT have any effect on the CLI SAPI. Yes, I know, it's very stupid and frustrating. I disagree with the way cPanel handles that, but there's nothing I can do about it.

You need to ask your host if there is a way on their hosting environment to change the configuration of the PHP 8.1 CLI SAPI. If they do not know, or they are completely unaware that configuring EasyPHP in cPanel has no effect under CLI, I can tell you how I solved the exact same issue on my cPanel-hosted sites. You need to add the argument -dmemory_limit=1024M after the PHP binary. Therefore, your command line must change to:

/usr/local/bin/ea-php81 -dmemory_limit=1024M /home/townof31/public_html/cli/joomla.php akeeba:backup:take

I noted the necessary change in bold type.

Further to that, I believe that you were misled about your memory limit in general.

If you checked your cPanel's server status to find out your PHP version and its memory limit, sorry, this has actually nothing to do with your site and/or PHP under CLI. cPanel is written in PHP, but it runs in its own web server, with its own PHP installation, with its own PHP configuration. What you see there is the configuration of cPanel's own PHP installation, not the one you are using.

If you checked Joomla's PHP information, or used a file to run phpinfo() and display its results over the web, you were unwittingly misled as well. What you saw is the configuration of your web SAPI  (one of CGI/FastCGI, Apache module, or PHP-FPM, depending on how your server is configured). Its configuration does not apply to the CLI SAPI.

As you can now better understand, the message you got is correct. It's just that the way cPanel works is very misleading and took you down to the wrong path.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

kentmorrison

Nicholas,

Thanks very much for this very complete reply.

I had no intention of yelling, I was using the caps for friendly emphasis.

I will investigate as you have directed and will report back to let you know what I find.

Thanks,
Kent

 

kentmorrison

Nicholas,

Also, please tell me why this memory issue casues the CRON backup jobs to fail, but I can make a backup manually from the menus ?

How is the CRON job different from the menu flavor backup ?

thnx,
Kent

System Task
system
The ticket information has been edited by Kent Morrison (kentmorrison).

kentmorrison

Nicholas,

The wait on hold to speak to a tech at InMotion took longer than it took the tech to find the resolution.

The way cPanel handles MultiPHP has a bunch of goofy symbolic link directories, blah blah. It makes it difficult and ill-advised to do manual edits directly to the .ini files.

I can use vi just fine, but could not find the correct file to edit.

 

The VPS overseer thing is called WHM. It has a separate PHP INI editor that handles the global parameters.

 

Please see attached .PDF for exact details.

 

Feel free to share with other support clients, this is an easy fix.

 

Thanks very much for the rapid help on this issue Nicholas.

 

Regards,
Kent

 

 

nicholas
Akeeba Staff
Manager

Also, please tell me why this memory issue casues the CRON backup jobs to fail, but I can make a backup manually from the menus ?

I already told you ;) The CRON job always runs under the PHP CLI SAPI. Most other backup methods – backend backup, legacy frontend backup URL, Joomla! Scheduled Tasks when the task runner is NOT a CRON job, Akeeba Backup JSON API – run over the PHP web SAPI. Each SAPI has its own configuration. Your cPanel configuration, the one with plenty of available PHP memory, is only applied to the web SAPI. So yup, the web SAPI backups with plenty of memory work, whereas the CLI SAPI backups with inadequate memory fail.

Feel free to share with other support clients, this is an easy fix.

The definition of "easy" varies greatly. Depending on your hosting configuration and your host you may not have access to WHM, or root access to the server at all. I have access to WHM on my managed Rochen server, but no root access, therefore I cannot edit the php.ini file directly. This is not an option at all for the reseller hosting I have for my personal sites.

On top of that, this is something you will have to redo next time you update your PHP version, in a a few months and every 1-2 years after that. Just this part makes me reluctant to label it as an "easy" fix.

Adding -dmemory_limit=1024M to the CRON job is a far easier and more maintainable workaround, in my humble opinion. I've been doing that since I was using PHP 7.3 on my CRON jobs. When I upgraded them to 7.4, then 8.0, then 8.1, then 8.2 I just had to change the PHP version in the front of the command line without having to remember to edit any php.ini files. That's why I recommended that :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

kentmorrison

Nicholas,

I have a good relationship with A2 hosting, they have really nice VPS servers for a great price.

Would you like to take a look at their VPS hosting packages and consider using them as your primary hosting company ?

I know that they would value your business.

https://www.a2hosting.com/vps-hosting/

A2 is truly corporate grade hosting.

 

Regards,
Kent

nicholas
Akeeba Staff
Manager

I am perfectly happy with Rochen, thank you :) 

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!