Cron jobs not running - PHP Fatal error:

Hi,
I am getting a red triangle icon with an exclamation mark and a message “The crons need to be enabled” error on a new Self-Hosted ver5.5.24 W93 installation. Several test installations produced the same issue which did not disappear even after several days.

This is the cron job command that I have in my cpanel.

cd /home/xxxxx/public_html/iv && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

Tried run the command with a single “>” in the “schedule:run >> /dev/null 2>&1” part of the command but the results is same.

Manually running the above cron job command in the terminal is producing the following error in the “error_log” (this file is in the invoice ninja root directory)

[04-Oct-2022 19:40:02 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2621440 bytes) in /home/xxxxx/public_html/iv/vendor/composer/autoload_static.php on line 1013

Could this issue be related to the artisan command in my above cron job command? Because I get the same error when I run any artisan command, including the “php artisan optimize”. Whenever I make changes to .env file I have to run the command as “php -d memory_limit=-1 artisan optimize”

Increasing memory_limit to 2048M in php.ini did not help.
There is no error log in storage/logs folder.

I’ve been searching for a solution to this problem for the past couple of days but could not find any.

Any ideas why I am having this problem?

Thanks in advance for any help.

image


php.ini
; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (PHP Home - EasyApache 4 - cPanel Documentation)

allow_url_fopen = On
display_errors = Off
enable_dl = Off
file_uploads = On
max_execution_time = 300
max_input_time = 60
max_input_vars = 5000
memory_limit = 1032M
post_max_size = 118M
session.gc_maxlifetime = 1440
session.save_path = “/var/cpanel/php/sessions/ea-php81”
upload_max_filesize = 112M
zlib.output_compression = Off
allow_url_include = On

It looks like the process executing only has 32mb assigned to it which is very very low

Somehow there is another PHP process running the script, you’ll need to dive in and make sure the system is using the PHP process which has the higher memory limit assigned.

Thanks for the reply, David. I have done some research regarding your answer but I got nowhere as I am very new to this.

Since this issue occurs with a brand new Invoice Ninja installation as well, I assume it has something to do with my shared hosting server. Is there any specific questions that I should ask my hosting provider to point them in right direction to resolve this problem?

Meanwhile, I have done more in depth tests and I noticed that “php artisan optimize” command works without PHP Fatal error when I increase the php memory limit in php.ini to;
“memory_limit=2048M”
However, “cron job” command still produces the same error even if I disable the php memory limit using ;
“memory_limit=-1”
I also get following error in Invoice Ninja “Health Check” when I disable the memory limit
image
Hope this info will be able to give you some clues.
Again, thanks for all the help.

David, this problem has been resolved by my hosting provider. I am not sure exactly how it has been resolved but this was the response I got from them;

“Some how the compose not use php version from php selector. So i just change to use easy php from multiphp editor.”

So now the cron job error exclamation mark is gone and everything seems to be in order.

Btw, I have been trying to familiarize myself with version 5 over the past few weeks. I was able to iron out many issues, almost all of them due to my hosting related. Now everything seems to be working perfectly. The version 5 is awesome when compared to anything similar out there. Thanks for developing such a great application and also for the great support. I will renew my white label license soon.
Cheers!

1 Like

@alex_t45

Thanks for the update!