Jump to content

Allowed memory size (phpinfo) issue


Craft

Recommended Posts

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?

 

phpinfo.png

Link to comment
Share on other sites

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)"} []

 

 

memory_limit.png

Link to comment
Share on other sites

  • WHMCS Staff

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

 

Link to comment
Share on other sites

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

memory_limit.png.ee301df5bf1b9ab819382590c98cf97b.png

Edited by Craft
Link to comment
Share on other sites

  • WHMCS Staff

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • WHMCS Staff

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
Link to comment
Share on other sites

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 :)

 

Link to comment
Share on other sites

  • WHMCS Staff

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...
  • 6 months later...

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

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated