MyBB Community Forums
[Error Message] Fatal error: allowed memory size... - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: [Error Message] Fatal error: allowed memory size... (/thread-196591.html)



Fatal error: allowed memory size... - tamme - 2016-07-29

So I keep getting these errors: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1285476 bytes) in .../inc/functions.php on line 7985 whenever I try to change forum permissions/change forum settings. I have increased the memory allowance in my php.ini file. We are on a VPS with 40 GB RAM to spare, and the host says it is definitely not them - they've increased the memory. 

We've disabled all plugins and the issue remains. 

We've restarted the server. 

We've restarted apache. 

We've put up the htaccess to remove users and the memory usage didnt' change/error remains. 

I am officially at a loss. 


This i s line 7985: preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);


We are on version 1.8.5.


RE: Fatal error: allowed memory size... - Matt - 2016-07-30

In ./inc/config.php, around line 80, you should see this:

$config['database']['encoding'] = 'utf8';

Can you change this to:

$config['database']['encoding'] = 'utf8mb4';

See if that does anything? This will change slightly what the function in question does, may be worth changing it quickly, and seeing if you can submit anything. Whether it does or doesn't work, change it back to utf8 afterwards as I think the database may need converting if the encoding is changed permanently.


RE: Fatal error: allowed memory size... - tamme - 2016-07-30

(2016-07-30, 05:35 PM)Matt. Wrote: In ./inc/config.php, around line 80, you should see this:

$config['database']['encoding'] = 'utf8';

Can you change this to:

$config['database']['encoding'] = 'utf8mb4';

See if that does anything? This will change slightly what the function in question does, may be worth changing it quickly, and seeing if you can submit anything. Whether it does or doesn't work, change it back to utf8 afterwards as I think the database may need converting if the encoding is changed permanently.

I have done what you said, and now the error has changed lines. Ugh. Error still occurs when trying to change permissions/settings and click "save forum".

NEW ERROR: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2570951 bytes) in .../public_html/inc/db_mysql.php on line 979

979, according to dreamweaver's code editor anyway, is
$string = mysql_real_escape_string($string, $this->read_link);


(Changed back to UF8)


RE: Fatal error: allowed memory size... - Matt - 2016-07-30

ಠ_ಠ

Okay, change that setting back to what it was.

Can you up your memory limit to like 128M? You could probably do it in your .htaccess file as well as php.ini. Not as a permanent fix but just to see if there is a point at which it does work.


RE: Fatal error: allowed memory size... - tamme - 2016-07-30

(2016-07-30, 05:51 PM)Matt. Wrote: ಠ_ಠ

My thoughts exactly.

The php.ini file
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 300
max_input_time = 60
max_input_vars = 1000
memory_limit = 128M

That didn't work.

Then I made an active .htaccess file in the public_html folder: and added the line php_value memory_limit 128M

Aaannnddd still getting the same error in the same place:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1285476 bytes) in .../public_html/inc/functions.php on line 7985


RE: Fatal error: allowed memory size... - Matt - 2016-07-30

Still the same number of bytes being exhausted though :/ Can you create a PHP file called test.php or something and put this in it:

<?php echo ini_get('memory_limit'); ?>

What does that output? Just to be 100% sure of the value PHP is seeing.


RE: Fatal error: allowed memory size... - tamme - 2016-07-30

(2016-07-30, 09:38 PM)Matt. Wrote: What does that output? Just to be 100% sure of the value PHP is seeing.


Hyperlink: http://helovia.net/test.php
LOLZ. 128M Smile

I went back and repaired all the database tables with overhead and still nothing. Overhead was minimal, though.


RE: Fatal error: allowed memory size... - Matt - 2016-07-30

Hm, okay. Was there a point that it did work and then suddenly broke?

Would you mind PMing me some FTP login details so I can try and debug? I think the best thing for me to do would be to basically step through the code adding breakpoints, log out posted data etc. 32MB should be more than enough so I'm curious as to what's going on here.


RE: Fatal error: allowed memory size... - tamme - 2016-07-31

(2016-07-30, 11:12 PM)Matt. Wrote: Would you mind PMing me some FTP login details so I can try and debug? I think the best thing for me to do would be to basically step through the code adding breakpoints, log out posted data etc. 32MB should be more than enough so I'm curious as to what's going on here.


Will do. And you know, the shitty part is that I haven't had to update the boards in such a long time that I didn't notice. I wouldn't be able to tell you exactly when it started.

Fixed! Even though all signs showed that we were pulling 128M available, the server was not allocating the proper memory. Had to go in and tinker with the VPS settings.