0
votes

I transferred the web directory of a site to new hosting. after importing the directory and the DB, I got this error:

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/libraries/joomla/database/database/mysql.php on line 712

I found my .htaccess file that was empty and added the line php_value memory_limit 256m, and it didn't work, I changed it to 512m, which is the highest that they support and still doesn't work. Can someone help me please.....Never thought a site transfer would be this difficult.


so I added the folloing to .htaccess php_value memory_limit 512M php_flag display_errors 1 php_value error_reporting 8191

RewriteEngine on RewriteBase /

and I get the following

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/jantispam/jantispam.php on line 90

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/jantispam/jantispam.php on line 68

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/jantispam/jantispam.php on line 261

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/jantispam/jantispam.php on line 274

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/jantispam/jantispam.php on line 39

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/slprettyphoto/slprettyphoto.php on line 30

Strict Standards: Only variables should be assigned by reference in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/plugins/system/ctkfbinit/ctkfbinit.php on line 94

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 79 bytes) in /mnt/stor12-wc1-ord1/895923/www.youth-panel.com/web/content/libraries/joomla/database/database/mysql.php on line 712

I will try turning off those plugins to see what happens

3
did the DB import correctly? Also, your host might be able to help even more than us! - Jacob Raccuia
Adding these settings to .htaccess requires that your hosting provider have configured their server to allow overrides via .htaccess. It's far from a sure thing. You need to talk to them, not Stack Overflow. - meagar♦
Most of the time, when you exhaust the memory, the problem is not that the limit is too low. The problem is some code using up all the resources. Check your queries - Ibu
Your error says your limit is 512m... (536870912 bytes == 512m). After re-reading your question a few times I'm not sure if you're asking how to change the memory limit (which you already have) or where to go from here since 512 still isn't enough. - Mike B

3 Answers

1
votes

Your current configuration allocates 512 MB of RAM to your PHP scripts. I don't know about you, but my server has 12 GB of RAM available. This means that if only about 20 people tried to run that script of yours at the same time, my server would thrash and die.

Consider fixing the memory problem in the code, rather than blindly increasing memory limits. Personally, I would recommend setting the max memory size to something restrictively small, such as 16MB, to force yourself to write more efficient code - works for me!

1
votes

You may try to add this at the top of the code

<?php
set_time_limit(0);
ini_set('memory_limit', '-1');
?>

But it is highly suggested that you should check your code and make it efficient to use less memory.

0
votes

Two possibilities -

First, you need to increase the value of "memory_limit" in php.ini.

Second, you could have a problem with your code that is allocating too much memory.