Memory limit issues when attempting to run Wordpress site locally - php

I'm working on a wordpress website and I'm attempting to set up a local test-environment for development purposes. I'm running the MAMP (Mac Apache MySQL PHP) stack.
I'm running into the following error:
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes) in /Users/casey/Documents/workspaces/yofreesamples.com/wp-includes/functions.php on line 1174
I've attempted to increase the memory limit by modifying line 28 in wp-config.php:
define('WP_MEMORY_LIMIT', '2024MB');
and by including the following value in index.php
ini_set('memory_limit','64M');
without any luck for any memory values I've tried. I'm relatively new to wordpress, anyone have any idea what's going on?

Perhaps the MAMP configuration doesn't allow you to override the memory limit programmatically. Set it in php.ini as described here.

Related

cakephp cli throws PHP fatal error

The original installation was on Ubuntu 14.04 with PHP 5.5.9 and CakePHP 5.4.1. After migrating to Ubuntu 16.04 with PHP 7.0.30 I updated CakePHP to 2.10.4 mainly by exchanging the lib folder. Everything works fine in the web interface, even the memory consuming tasks of the application.
But the CLI is broken. Every call to 'app/Console/cake' throws a 'PHP Fatal error'.
root#watt18:/var/www_external/app# Console/cake bake
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 8192 bytes) in /var/www_external/lib/Cake/Console/ConsoleOptionParser.php on line 510
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /var/www_external/lib/Cake/I18n/I18n.php on line 1
The 'in' part changes from call to call. Searching the web I could not find any comparable topic. I checked the persmissions on all the folders inside 'app' but could not find any differences to the original installation. I tried to debug but couldn't get really far yet. Up to the line return ShellDispatcher::run($argv); in Console/cake.php everything is fine.
I get the same result when making a call inside the original cakephp folder from a fresh download.
I have no idea where all the memory gets lost.I would be happy about any hint to what might cause the problem or how to continue with debuging.
set memory_limit = -1 in your php.ini
but this is not a good solution , you may have a memory leake somewhere
please double check your statements , specialy if there is a loop with many memory usage

PHP out of memory error does not reflect memory_limit setting in php.ini

When I try to install a package to Contao using the Composer client I get an error:
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 134217728 bytes) in phar://D:/wamp/www/myproject/composer/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220
I am really confused. My PHP memory limit is set at 512M. phpinfo() confirms it. But 1073741824 is a gigabyte! And it still isn't enough, as if the script totally disregards the PHP memory limit (where?) and even a gigabyte isn't enough!?!?
What can I do? I read about RLimitMEM, but I can not find such a setting anywhere on WAMPServer.
I found the answer.
I searched the project for memory_limit and found out, that the composer client attempts to set a memory limit in system/modules/!composer/src/Runtime.php There is this line: #ini_set('memory_limit', '1024M'); I changed it to #ini_set('memory_limit', '2048M'); essentially doubling the available memory, and it worked.
It is recommended to use the so called detached mode for the composer client. If you have a proper CLI environment available, you'll have no memory limit and no maximum execution time. Also both of these limits can be controlled via command line arguments.
However, this does not work in all hosting environments. See this Wiki entry for more details: https://github.com/contao-community-alliance/composer-client/wiki/Execution-modes

website down with php error

i do not know php but had installed wordpress, i visit my site and see the following error
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 98304 bytes) in E:\Domains\mysite.com\wwwroot\wp-content\plugins\wordfence\lib\wfLog.php on line 431
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 98304 bytes) in E:\Domains\mysite.com\wwwroot\wp-content\plugins\wordfence\lib\wfLog.php on line 431
how do i fix hat above, please guide
You have a plugin called Wordfence which is causing the problem. It appears to be overloading your memory. I wouldn't mess with your server config, the problem is with the plugin. Try deleting those logs, that should work, but it may only be a temporary solution. Removing the plugin would certainly solve the problem. No idea what Wordfence is though. If that doesn't work, change the title of your question to include "Wordfence plugin".
In my opinion i have got a better solution for you. All you need to do is just to increase memory size.
By default, when you installed and configure Wordpress it comes by 16MB memory . In your case, you can keep the plugin you already installed and add the following one line code to your wp-config.php file.
You can access this file via FTP(File Transfer Protocol) client FileZilla or from your hosting cPanel.
/* Increase memory */
code : define( 'WP_MEMORY_LIMIT', '96M' );

Allowed memory size exhausted in both Joomla and Drupal

I am trying to set up a website using Joomla and this is the error I get after accessing localhost (right after successful installation process):
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 98304 bytes) in [...]\default_item.php on line 77
The same thing happens when using Drupal (before installation though). I have already tried changing php.ini (in location given by Joomla itself, so it's the right one. Interestingly, website on localhost does not work, while admin panel on localhost/administrator works, that's where I got the file location from) to look like this:
memory_limit = 512M
I also tried putting ini_set('memory_limit', '512M'); inside the script indicated in error and freeing some of my RAM, but still - no success.
I use WebServ, which uses Apache 2.2.6 and PHP 5.2.5.
What more can I do to overrun this problem?
Edit:
Output of phpinfo(); for Joomla
ini_set('memory_limit', '-1'); overrides the default PHP memory limit.
By the way look out for never ending loops. It might be causing the error.

wordpress Fatal error: Out of memory

I have set php memory limit from whm to 256M from WHM > PHP Configuration Editor.
Even so, my wordpress website and admin is showing me an error like below.
Fatal error: Out of memory (allocated 36175872) (tried to allocate 30720 bytes) in /home/XXXX/public_html/wp-includes/class-simplepie.php on line 14272
Fatal error: Out of memory (allocated 35127296) (tried to allocate 1966080 bytes) in /home/XXXX/public_html/wp-includes/class-simplepie.php on line 5427
I also tried to add following line to the top of wp-config.php, but no luck and same error.
define('WP_MEMORY_LIMIT', '128M');
can anyone suggest me or tell me what may be the solution?
I finally think I've solved the White Screen of Death from PHP out of memory Fatal Errors.
Full details here: http://www.isthisyourhomework.com/how-to-fix-the-wordpress-white-screen-of-death/
If setting the WordPress and PHP memory limits doesn't work for you, try adding/edditing the following line in either your Apache conf files. I didn't have access to those, so I added the following line to the .htaccess file in my WP server's document root:
RLimitMEM max
Many hosts have set limits on each user on shared-use servers. The above setting will unfetter your server and banish the WSOD.
The SimplePie people reckon that this is caused by a bug in PHP. It was fixed in PHP version 5.3. Upgrading might help.
Newer versions of SimplePie use less memory but still suffer from the same PHP bug that causes lots of cached items to cause you to use loads of memory.
Did you change the memory limit in php.ini(or through WHM service configuration page)? If so, try rebooting Apache

Categories