I have a website in wordpress, under PHP 7.0. My server logs are filled with:
wordpress: Fatal error: Out of memory (allocated 56623104)
My question is where is this value 56623104(~56M) taken from? Where should I look?
In my php.ini I have:
php -i | grep memory_limit
memory_limit => 2048M => 2048M
In wp-config.php I have:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '1024M' );
Also I have enough free memory:
total used free shared buffers cached
Mem: 3945 2848 1096 0 57 1298
-/+ buffers/cache: 1492 2453
Create a new file called anything like you (with php) so phpinfo.php for example. Then put this in:
<?php
phpinfo();
?>
Upload it to your site and open it in the browser, check that the memory is actually 256. Pop it in a sub directory and check its the same there.
Related
test.php
<?php
sleep(45);
phpinfo();
upon executing above code,
after 47 sec, i'm getting response :
max_execution_time 30 | 30
strange but yes phpinfo() showing invalid timeout value.
upon sleep(75);phpinfo(); after 61 sec I'm getting request timout error in browser.
Problem: Not sure why phpinfo() is showing invalid value?
PHP Version: 5.6.29
Server API: FPM/FastCGI
php-fpm: active
NGINX_VERSION: 1.11.8; linux
from above tests, it seems, server max_execution_time is 60 sec but its showing 30sec in phpinfo();
No, this is entirely expected. sleep() is blocking call. PHP doesn't know it has timed out until the execution thread is scheduled by the OS.
Try:
for ($x=0; $x<30; $x++) sleep(2);
<?php
set_time_limit(300)
sleep(45);
phpinfo();
set new max_execution_time with set_time_limit() function
After changing all the WordPress permissions to 777 and assigning them to group of apache:apache still Wp Super Cache plugin can't change the wp-config.php
I don't know why!
My server is :
CentOS 7
PHP 71
Apache
MariaDB
Apache Error Log:
[Thu Nov 02 02:01:45.637165 2017] [php7:warn] [pid 17633] [client 5.202.27.148:25292] PHP Warning: include(): Failed opening '/var/www/html/wp-content/plugins/wp-super-cachewp-cache-base.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 72, referer: http://website.com/wp-admin/post.php?post=10821&action=edit
Wordpress Error:
Warning! You must set WP_CACHE and WPCACHEHOME in your wp-config.php for this plugin to work correctly: define( 'WP_CACHE', true );
define( 'WPCACHEHOME', '/var/www/html/wp-content/plugins/wp-super-cache' );
This is right. wp-config should be writeble only by user manually. This file should not be writable using code. Please put these configuration manually in your wp-config.php.
My problem solved by disabling SELinux that prevents apache user from editing files and folder.
After I have moved GoDaddy to a different server VPC Wordpress shows
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 72 bytes) in /home/rm/public_html/wp-includes/pomo/streams.php on line 110
When I try to log in as admin:
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 78 bytes) in /home/rm/public_html/wp-includes/pomo/mo.php on line 297
What can I do to resolve this issue?
You need to paste this code in wp-config.php file.
define( 'WP_MEMORY_LIMIT', '256M' );
This code tells WordPress to increase the PHP memory limit to 256MB.
I hope this will help you.
How do I handle "Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 49152 bytes) in /home/ezzy0881/public_html/wp-includes/SimplePie/Item.php on line 662"?
You need to increase the amount of memory allocated to WP. In your wp-config.php file, add define( 'WP_MEMORY_LIMIT', '64M' );. wp-config.php should be editable within the admin. Otherwise, get FTP access and you'll find the config file in the root of you site.
I have a big problem...
I want to update the schema of my database and I have a problem.
When I a running this script:
php app/console doctrine:schema:update --dump-sql
I have this error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /Applications/MAMP/htdocs/myApp/vendor/doctrine/lib/Doctrine/ORM/Tools/SchemaTool.php on line 509
I have tried to increase memory_limit in php.ini but nothing works.
I have ran the php app/console cache:clear but it does nothing. Still the same problem...
Please help...
I can't do nothing...
Do:
php -d memory_limit=200M app/console doctrine:schema:update --dump-sql
200M or higher
First of all check php.ini location by creating php file that outputs php's configuration
<?php
phpinfo();
Run this file in a browser and check "Loaded Configuration File" this is the location of php.ini.
Another method to solve the issue is to add the next line of code to app/console file:
ini_set('memory_limit', '64M');
64 MB should be enough
Consolidate and Summarize of all answers and comments:
It does not matter what command you issue, what matters is your PHP configuration.
This is the error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 434032 bytes)
Solution: in your php.ini change to this example, and restart Apache/web server:
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit=512M
Tested and working.