Solved - Email notifications are no longer working

My invoice ninja (version 5.5.32-C98) is hosted on a shared hosting. Everything was working fine until about 2 months ago when recurring invoice notifications stopped working.

I spent lot of time researching this problem but can’t figure it out. I did upgrade to the latest version, changed php version to 8.1 with memory increase. However, the problem persist. I hope someone can guide me in the right direction.

Here’s what I have in the shared hosting crontab:
MAILTO="email@example.com"
SHELL=“/bin/bash”

          • cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php artisan schedule:run >/dev/null 2>&1
          • cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan schedule:run >/dev/null 2>&1
            */5 * * * * cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty
            30 5 * * * cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php artisan ninja:send-invoices
            45 5 * * * cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php artisan ninja:send-recurring
            45 6 * * * cd /home/bargainp/portal.bargainpbx.com && /opt/cpanel/ea-php81/root/usr/bin/php artisan ninja:send-reminders
            20 17 * * 6 /usr/local/cpanel/3rdparty/bin/php -d disable_functions=“” “/usr/local/cpanel/whostmgr/docroot/cgi/softaculous”/cli.php --backup --auto=1 --insid=491_15957

I checked laravel.log but don’t see any error.

Just to test if email is working I removed >/dev/null 2>&1 from the first crontab line and changed artisan to artisan1. After I saved crontab entry, I started seeing error email every minute. This means email itself is working.

Thanks in advance.

Hi,

You seem to have the schedule:run cron twice as well as the v4 and v5 crons setup but I’m not sure that explains the problem.

@david any thoughts?

@hillel - I was trying to make changes to crontab based on my research thinking something will fix.

On a separate topic, how do I send recurring invoice manually? I don’t see an option for this.

@pokemon786

You may want to discuss with your host the correct configuration to get the cron working, you commands look ok to me, so I wonder if there is something specific in your configuration.

You can run the following from the command line to send recurring invoices

php artisan ninja:send-recurring

@david - As I mentioned in my first post, I did test cron functionality and it appeared to be working as I was getting error notification email every minute. I don’t think there’s any issue with cron.

To test it further, I have turned debug on in .env file, issued php artisan optimize and then tried
php artisan ninja:send-recurring and php artisan ninja:send-reminders

However, I did not see any log entry in laravel.log file.

Thoughts?

I noticed below message every minute (2 times with few seconds apart) in error_log in the root folder, which does not make sense as I have already changed memory limit to 512M on php.ini file:

PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2621440 bytes) in /home/portal/vendor/composer/autoload_static.php on line 1013

Could this be a problem? If yes, how do I fix this?

For anyone else having the same issue, here’s how to fix it.

While my local php.ini memory_limit was changed to 512M the application was still using value from master php limit which was set as 32M. After my hosting provider increased this value to 128M, things started working. I also do not see memory exhausted error anymore.

1 Like