Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP memory_limit locked to 256MB?

Tags:

php

I am trying to set memory_limit to 512M, but it's locekd to 256M.

ini_set('memory_limit','512M');
ini_get('memory_limit');    //> Returns: 256M

I have full control on my server. (it's a dedicated)

Please note that everything under 512M works.

ini_set('memory_limit','16M');
ini_get('memory_limit');    //> Returns: 16M

Solution

I found out why. in php.ini I had memory_limit = 256M. Maybe this is considered as an upper limit

like image 868
dynamic Avatar asked Mar 01 '12 15:03

dynamic


People also ask

What is the PHP memory limit?

The PHP memory limit sets the maximum amount of memory any script on your website can use. But what exactly does that mean? Your website is powered by servers, which are just specialized computers used to keep the backend of a website running. Like normal computers, they use components like processors, storage, and RAM — also known as memory.

What is kinsta’s PHP memory limit?

What Is Kinsta’s PHP Memory Limit? Users of all Kinsta plans enjoy a default PHP memory limit of 256 MB. This should be more than enough for 99% of all WordPress plugins and is in fact far more than most plugins should ever take.

How do I increase the memory of a PHP script?

Simply increase the default value (example: Maximum amount of memory a script may consume = 128MB) of the PHP memory limit line in php.ini. If you don’t have access to these files or lack the experience to make this change, you can contact your web host and ask them to increase your PHP memory limit.

What is the WordPress memory limit?

The WordPress memory limit is also known as WordPress PHP memory limit or simply PHP memory limit. It mainly sets the maximum amount of memory that a script can use on the website. Servers store all the data and files of websites.


1 Answers

3 possibles I can think of / find:

Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using --enable-memory-limit in the configure line.

OR

The issue detailed here: ini_set("memory_limit") in PHP 5.3.3 is not working at all

OR

ini_set is disabled

like image 80
Ingmar Boddington Avatar answered Oct 19 '22 04:10

Ingmar Boddington