Craft Posted January 7, 2020 Share Posted January 7, 2020 Everyday I see this error in the error log file [07-Jan-2020 00:04:29 US/Central] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8424072 bytes) in /home/craft/account/vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3026 [07-Jan-2020 00:04:29 US/Central] [WHMCS Application] ERROR: Whoops\Exception\ErrorException: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8424072 bytes) in /home/craft/account/vendor/phpmailer/phpmailer/src/PHPMailer.php:3026 Stack trace: #0 /home/craft/account/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError(1, 'Allowed memory ...', '/home/craft/a...', 3026) #1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown() #2 {main} {"exception":"[object] (Whoops\\Exception\\ErrorException(code: 1): Allowed memory size of 67108864 bytes exhausted (tried to allocate 8424072 bytes) at /home/craft/account/vendor/phpmailer/phpmailer/src/PHPMailer.php:3026)"} [] I set the (memory_limit to -1) in (php.ini) file to remove the limit but I still get the error! Any suggestions? 0 Quote Link to comment Share on other sites More sharing options...
wsa Posted January 7, 2020 Share Posted January 7, 2020 try 1048M to see if work 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 7, 2020 Author Share Posted January 7, 2020 3 hours ago, wsa said: try 1048M to see if work Ok I will try it. 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 10, 2020 Author Share Posted January 10, 2020 On 1/7/2020 at 8:56 PM, wsa said: try 1048M to see if work I changed it to 1048M but the error is still occurs [10-Jan-2020 00:03:42 US/Central] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8605384 bytes) in /home/craft/account/vendor/phpmailer/phpmailer/src/SMTP.php on line 657 [10-Jan-2020 00:03:42 US/Central] [WHMCS Application] ERROR: Whoops\Exception\ErrorException: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8605384 bytes) in /home/craft/account/vendor/phpmailer/phpmailer/src/SMTP.php:657 Stack trace: #0 /home/craft/account/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError(1, 'Allowed memory ...', '/home/craft/a...', 657) #1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown() #2 {main} {"exception":"[object] (Whoops\\Exception\\ErrorException(code: 1): Allowed memory size of 67108864 bytes exhausted (tried to allocate 8605384 bytes) at /home/craft/account/vendor/phpmailer/phpmailer/src/SMTP.php:657)"} [] 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Staff WHMCS Peter Posted January 10, 2020 WHMCS Staff Share Posted January 10, 2020 Hi there! Based on the log and how the error appears to occur during email sending, this would leave me to believe that this error may be occurring during your cron run. Could you please run the following command in SSH to confirm your memory_limit there? php -i | grep memory_limit 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 10, 2020 Author Share Posted January 10, 2020 (edited) 31 minutes ago, WHMCS Peter said: Hi there! Based on the log and how the error appears to occur during email sending, this would leave me to believe that this error may be occurring during your cron run. Could you please run the following command in SSH to confirm your memory_limit there? php -i | grep memory_limit It printed 64M because the server is set to 64M in this php version. But I'm using a custom "php.ini" in my website only which is hosted on this server, and I set it to 1048M Edited January 10, 2020 by Craft 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Staff WHMCS Peter Posted January 10, 2020 WHMCS Staff Share Posted January 10, 2020 Hi, In that case, you'll need to update your cron job to use this custom configuration. To do that, you can use the -c flag. For example, if your cron was: php -q /path/to/crons/cron.php You should update it to php -c /path/to/custom/php.ini -q /path/to/crons/cron.php 1 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 10, 2020 Author Share Posted January 10, 2020 21 minutes ago, WHMCS Peter said: Hi, In that case, you'll need to update your cron job to use this custom configuration. To do that, you can use the -c flag. For example, if your cron was: php -q /path/to/crons/cron.php You should update it to php -c /path/to/custom/php.ini -q /path/to/crons/cron.php Nice, I think that's gonna work.. My current cron job is /usr/local/bin/php /home/craft/whmcsdata/crons/cron.php Is it correct after the modification? /usr/local/bin/php -c /home/craft/whmcs/php.ini /home/craft/whmcsdata/crons/cron.php 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Staff WHMCS Peter Posted January 10, 2020 WHMCS Staff Share Posted January 10, 2020 As long as /home/craft/whmcs/php.ini is the path to your custom .ini file, I suspect it will. You can confirm it with: /usr/local/bin/php -c /home/craft/whmcs/php.ini -i | grep memory_limit You are however ommiting the -q command which we do recommend. So I recommend your cron be: /usr/local/bin/php -c /home/craft/whmcs/php.ini -q /home/craft/whmcsdata/crons/cron.php 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 10, 2020 Author Share Posted January 10, 2020 32 minutes ago, WHMCS Peter said: As long as /home/craft/whmcs/php.ini is the path to your custom .ini file, I suspect it will. You can confirm it with: /usr/local/bin/php -c /home/craft/whmcs/php.ini -i | grep memory_limit You are however ommiting the -q command which we do recommend. So I recommend your cron be: /usr/local/bin/php -c /home/craft/whmcs/php.ini -q /home/craft/whmcsdata/crons/cron.php I think there is something wrong with me in this commad /usr/local/bin/php -c /home/craft/whmcs/php.ini -i | grep memory_limit It always printing (128M) while my server is set to 64M and my website custom php.ini is set to 1048M I tried to change the website and used another username of another website on the server, it printed 128M also (Note: this website is using the default server value of 64M too) Ok, now I updated my cron job and I'll use the last one you told me about and gonna wait until the next cron job time tomorrow, then I will update you with the result :) 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Staff WHMCS Peter Posted January 10, 2020 WHMCS Staff Share Posted January 10, 2020 Sure thing. If you notice an inconsistency between the memory_limit value in /home/craft/whmcs/php.ini and the one output in the CLI when running the command I provided, I'd definitely reach out to your System Administrator for assistance in diagnosing why that is occurring. 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted January 10, 2020 Author Share Posted January 10, 2020 1 hour ago, WHMCS Peter said: Sure thing. If you notice an inconsistency between the memory_limit value in /home/craft/whmcs/php.ini and the one output in the CLI when running the command I provided, I'd definitely reach out to your System Administrator for assistance in diagnosing why that is occurring. Thank you :) Let me test it first tomorrow in the next cron job, and get back to you with the result. 0 Quote Link to comment Share on other sites More sharing options...
vineash00199 Posted February 8, 2020 Share Posted February 8, 2020 Based on the log and how the error appears to occur during email sending, this would leave me to believe that this error may be occurring during your cron run. Could you please run the following command in SSH to confirm your memory_limit there? 0 Quote Link to comment Share on other sites More sharing options...
netnow Posted August 12, 2020 Share Posted August 12, 2020 All, I am getting this error as well. It definitely happening with the 10 PM (Daily) cron run. Also, mine is related to PHPMailer as well. START SNIP ------------------------------------------------------- From: "(Cron Daemon)" <xxx@server.mydomain.com> Date: 2020-08-11 10:04 PM (GMT-05:00) To: me@mydomain.com Subject: Cron <xxx@xxx> /opt/cpanel/ea-php72/root/usr/bin/php -q /home/myuser/portaldata/crons/cron.php Whoops\Exception\ErrorException: Allowed memory size of 268435456 bytes exhausted (tried to allocate 33554440 bytes) in /home/myuser/public_html/portal/vendor/phpmailer/phpmailer/src/SMTP.php:657 #0 /home/myuser/public_html/portal/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError(1, 'Allowed memory ...', '/home/myuser/p...', 657) #1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown() #2 {main} END SNIP--------------------------------------- I have my memory limit set to 256M. [root@server user]# php -i | grep memory_limit memory_limit => 256M => 256M I am curious if/what CRAFT did to fix the error. Another question (if any knows). Is the "memory limit' set for an individual script, or is it the total scrip(s) memory allocation for any given user? -T 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted August 12, 2020 Author Share Posted August 12, 2020 11 hours ago, netnow said: All, I am getting this error as well. It definitely happening with the 10 PM (Daily) cron run. Also, mine is related to PHPMailer as well. START SNIP ------------------------------------------------------- From: "(Cron Daemon)" <xxx@server.mydomain.com> Date: 2020-08-11 10:04 PM (GMT-05:00) To: me@mydomain.com Subject: Cron <xxx@xxx> /opt/cpanel/ea-php72/root/usr/bin/php -q /home/myuser/portaldata/crons/cron.php Whoops\Exception\ErrorException: Allowed memory size of 268435456 bytes exhausted (tried to allocate 33554440 bytes) in /home/myuser/public_html/portal/vendor/phpmailer/phpmailer/src/SMTP.php:657 #0 /home/myuser/public_html/portal/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError(1, 'Allowed memory ...', '/home/myuser/p...', 657) #1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown() #2 {main} END SNIP--------------------------------------- I have my memory limit set to 256M. [root@server user]# php -i | grep memory_limit memory_limit => 256M => 256M I am curious if/what CRAFT did to fix the error. Another question (if any knows). Is the "memory limit' set for an individual script, or is it the total scrip(s) memory allocation for any given user? -T Try to change it to 512M instead of 256M for both (Website cPanel and Server WHM) 0 Quote Link to comment Share on other sites More sharing options...
netnow Posted August 13, 2020 Share Posted August 13, 2020 I think its the database backup that using so much memory. I noticed since I started getting the error (3 days now), that I have NOT been sent the database backups. I have done some log maint in the database, and the zipped backup size has gone from 40 MB to 3 mb. We'll see tomorrow if it runs OK. -T 0 Quote Link to comment Share on other sites More sharing options...
netnow Posted August 27, 2020 Share Posted August 27, 2020 Appears cleaning all the old and no longer needed log, then compacting the database did the trick. Been running for weeks now without issue. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.