Evening, I am try to run a script that need a lot of memory from the command line.
System is Linux LinuxMint 3.2.0-23-generic w/ PHP Version => 5.3.10-1ubuntu3.6
I have memory_limit -1 in php.ini for CLI and am also setting ini_set( 'memory_limit', '-1' );
but if I run phpinfo() via the command line it says:
memory_limit => 300M => -1
Does anyone have any idea why this is?
I've also tried setting the memory limit via the command on the CLI. No difference.
Thanks for the info, Sammitch, but when I am running scripts I get:
PHP Fatal error: Allowed memory size of 314572800 bytes exhausted (300MB)
It appears this is a system, issue, but I cannot fix it.
EDIT: after searching, I found I had set a memory limit of 300MB in my global config.php file. Be diligent!
You're not understanding the format.
variable_name => default_value => current_value
Related
I'm running a php script via terminal and I get this error message Allowed memory size of 536870912 bytes exhausted.
So i then added ini_set("memory_limit", "4096M"); to the php file and that did not work.
Then i run php --ini to see which loaded cli file (/etc/php/7.4/cli/php.ini) is being used and after editing said file i found that there is no memory limit set in it ini_set("memory_limit", "-1");
I have no idea what's going on (not very linux savvy). Where is it drawing the conclusion that it only has 512M of available memory?
Edit #1: I also did a phpinfo() which said the php.ini file is at /etc/php/7.4/apache2/php.ini so I edited that file as well, still getting the same result (restarted apache and initiated a new terminal window as well)
Edit #2: the script is run by php mylocalphpfile.php -params
Ubuntu 20, php 7.4
Ok found out that the forked script from Github has some references to other dependencies in which the memory_limit is being forced to be 512M.
Removed that line of code form the lib and now it's working.
I somehow can't change max_execution_time in the php.ini. It won't update even though I restarted the server.
It simply doesen't update this specific setting, but others seem to update fine.
info.php says max_execution_time = 30 (default). But when I execute
php -i | grep max_execution_time
it outputs
max_execution_time => 0 => 0
Running Apache version 2.4.34 on Ubuntu with php 7.2
I have tried everything, but couldn't find a solution to this problem. Im really stuck here, does anyone have a solution to this?
I am trying to run a product export with Magento's dataflow using the CLI script found here: https://www.kerstner.at/2015/07/run-magento-data-flow-profile-from-shell/
The issue I am facing is the script always stops with the following error:
Fatal error: Allowed memory size of 536870912 bytes exhausted
I have attempted to change the memory_limit for PHP in multiple places:
Changed all php.ini files
Added "ini_set("memory_limit","1024M");" to the code.
Input "php -d memory_limit=1024M" at the command line.
Checked the setting using the CLI command "php -i | grep
memory_limit"
Checked the memory_limit using phpinfo()
...and yet I cannot get the script to execute beyond 536870912 bytes.
Is there something built into Magneto that would stop this? I am running out of ideas.
My Environment:
OS: Ubuntu Server 16.04
Total/Free Memory: 8GB/6.9GB
PHP 7.0
PHP Settings:
/etc/php/7.0/apache2/php.ini : memory_limit = 1024M
/etc/php/7.0/cli/php.ini : memory_limit = 1024M
I searched everywhere but i really can't find anything. I am trying to run php artisan but it seems that it just doesn't work.
Specifically i run this command when i am connected through ssh :
/opt/cpanel/ea-php71/root/usr/bin/php artisan
It is the same with php artisan but i am choosing a specific php version (7.1.5). This command should normally show up the rest of artisan commands.
The error i get :
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted
(tried to allocate 4096 bytes) in
/home/username/laravel/vendor/composer/autoload_static.php on line
274
My hosting provider tried to increase the memory limit but nothing happened. I tried increasing it a lot through .php files too.
Also i have tried running composer install/update/clear cache/dump autoload.
Please ask for further information if needed,
Any ideas?
Try to check spelling in the php.ini file. That happened to me when I set memory_limit = 512MB (that is false) instead of memory_limit = 512M (wich is correct). For some reason php understood it as 2MB of memory.
I am trying to install PEAR into WAMP on Windows Server 2008.
When I do:
V:\wamp\bin\php\php5.4.12>php go-pear.phar
I get:
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to alloca
te 91 bytes) in Unknown on line 0
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 91
bytes) in Unknown on line 0
I have tried to solve the error via Googling but all I get is people saying to increase PHP memory limit. This is not the problem.
I have two php.ini files, one in Apache one in PHP. I don't know why there is two but regardless I have set the memory_limit in both to 4096MB, and I still get the error.
How can this be fixed so I can install PEAR?
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: V:\wamp\bin\php\php5.4.12\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
So it's definitely the correct INI file.
The error message tells you that the memory limit is 262144 bytes, which means 256kiB.
Run $ php --ini to find out which ini file is really used. Then run $ php -i | findstr memory and see what's really configured.
I have tried to solve the error via Googling but all I get is people
saying to increase PHP memory limit. This is not the problem.
In fact, that is the problem that Allowed memory size of 262144 bytes exhausted reports.
I have two php.ini files, one in Apache one in PHP. I don't know why there is two
Because you are not forced to have the same PHP settings in web applications and in command line applications. (PEAR belongs to the latter, BTW.) You can find the php.ini in use with the -i parameter:
php -i | more
Configuration File (php.ini) Path => C:\Windows Loaded
Configuration File => D:\DOS\PHP\php.ini Scan this dir for
additional .ini files => (none) Additional .ini files parsed =>
(none)
but regardless I have set the memory_limit in both to 4096MB, and I still get the error.
The memory_limit directive accepts either an integer (which represents bytes) or a shorthand notation where you can specify other units. Allowed suffixes include:
K (for Kilobytes)
M (for Megabytes)
G (for Gigabytes
Thus 4096MB is not a valid setting. (In any case, 4 GB is a huge amount; you possibly want a few hundred MB at most.)
I fixed it.
It seems one must state the memory limit in bytes.
So I just did memory_limit = 2147483648
Thanks for your input.