Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: Biology Forums on August 18, 2015, 12:34:10 AM

Title: Sending newsletter to 350K member forum fails.
Post by: Biology Forums on August 18, 2015, 12:34:10 AM
After I select all the groups I want to send a newsletter to, the following page (index.php?action=news;sa=mailingcompose) fails to load - it's just white. However, when I choose a smaller group of members to send to, it moves to the next page just fine. Does anyone else with a large forum have this problem?

The apache error log gives me:

PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 19 bytes) in /***/public_html/Sources/ManageNews.php on line 375, referer: http://***.com/index.php?action=news;sa=mailingmembers

:-\

How can I allot more memory if that's the case? You can cross out server hardware.
Title: Re: Sending newsletter to 350K member forum fails.
Post by: 青山 素子 on August 18, 2015, 01:16:50 AM
Wow, that's a lot of members. I don't think the newsletter function ever contemplated a number so high. Can you send in smaller batches?
Title: Re: Sending newsletter to 350K member forum fails.
Post by: LiroyvH on August 18, 2015, 01:17:26 AM
The error actually explains everything. It's not really an SMF error either, but a PHP warning.

But if you did not understand it, then a simple search here or on Google would yield instant results that you have to up PHP's memory_limit directive (in the server's php.ini) to something higher than what it is set at now. It's set *really* low right now.

Basically: fix your server configuration and it'll be happy again. :)


Quote from: 青山 素子 on August 18, 2015, 01:16:50 AM
Wow, that's a lot of members. I don't think the newsletter function ever contemplated a number so high. Can you send in smaller batches?

The newsletters here goes to that amount as well, no problem at all. :)
Title: Re: Sending newsletter to 350K member forum fails.
Post by: vbgamer45 on August 18, 2015, 08:40:07 AM
Add this to the top top of your Sources/Managenews.php file below the <?php

@ini_set("memory_limit","256M");
Title: Re: Sending newsletter to 350K member forum fails.
Post by: Biology Forums on August 18, 2015, 10:39:58 AM
Quote from: vbgamer45 on August 18, 2015, 08:40:07 AM
Add this to the top top of your Sources/Managenews.php file below the <?php

@ini_set("memory_limit","256M");


Your suggestion worked.

Now, I am going to apply this globally with php.ini.

Edit:

Moving to this page (index.php?action=news;sa=mailingsend) after composing the message also produces a white screen.

PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 7728283 bytes) in Unknown on line 0, referer: http://***.com/index.php?action=news;sa=mailingcompose
Title: Re: Sending newsletter to 350K member forum fails.
Post by: Biology Forums on August 18, 2015, 11:07:57 AM
I added the directive into .htaccess

php_value memory_limit 256M

And it worked. Adding it to the master php.ini isn't enough because the local value overrides it.
Title: Re: Sending newsletter to 350K member forum fails.
Post by: vbgamer45 on August 18, 2015, 11:08:29 AM
Good to know!
Title: Re: Sending newsletter to 350K member forum fails.
Post by: LiroyvH on August 18, 2015, 03:50:22 PM
Quote from: Shuban on August 18, 2015, 11:07:57 AM
I added the directive into .htaccess

php_value memory_limit 256M

And it worked. Adding it to the master php.ini isn't enough because the local value overrides it.


Hence why its discouraged to use .htaccess if you have full root access. :)
Altering in config works better for a variety of reasons for a variety of subjects, leaving it low in php.ini because a local value already exists is fixing an issue by altering the issue.
Title: Re: Sending newsletter to 350K member forum fails.
Post by: JBlaze on August 18, 2015, 06:06:04 PM
Also, using .htaccess by it's very nature slows down Apache :)
Title: Re: Sending newsletter to 350K member forum fails.
Post by: 青山 素子 on August 18, 2015, 09:28:26 PM
Quote from: zilladotexe on August 18, 2015, 06:06:04 PM
Also, using .htaccess by it's very nature slows down Apache :)

Even if you don't have an htaccess file. If you allow overrides, Apache checks each directory up to the document root for overrides (htaccess files).