PEAR Install out of memory - php

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.

Related

php memory on nginx doesnt work on increase on anything tricky

fyi this question is duplicate and many people ask to but i have collect all answer into my question what i did still on problem or doesnt work but i explain more detail and i want to know why.
similar on
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes)
and other have much response tell its duplicate and anything.
the case is
i have 3 server ( engine ) where run an application ( laravel web ).
A. my engine ( work/no error ): ( apache Ubuntu 18.04.6 LTS )
❯ free -m
total used free shared buff/cache available
Mem: 7976 865 497 18 6613 6797
Swap: 0 0 0
B. my engine ( doesnt work/error allocate memory ): ( nginx ) ( Ubuntu 18.04.4 LTS )
➜ ~ free -m
total used free shared buff/cache available
Mem: 7975 658 4312 22 3005 7006
Swap: 4095 1 4094
C. my engine ( doesnt work/error allocate memory ): ( nginx ) ( Ubuntu 20.04.1 LTS )
~ » free -m ~
total used free shared buff/cache available
Mem: 1987 1096 112 131 778 568
Swap: 0 0 0
what i do is run a query thats export a excel file where the data is from application is build until now , so need a big memory, time or processing. if see on yesterday there is have 9000 data/row.
what i was do ( with my three server )
increase configuration about memory on nginx/apache
tried override the setting on .httaccess/file.php/index.php to increase the memory processing
tunning mysql oracle/mysql mariadb
my server (B) on doesnt work is here :
(my configuration)
➜ ~ locate php.ini
/etc/php/7.4/apache2/php.ini
/etc/php/7.4/cli/php.ini
/etc/php/7.4/fpm/php.ini
/usr/lib/php/7.4/php.ini-development
/usr/lib/php/7.4/php.ini-production
/usr/lib/php/7.4/php.ini-production.cli
/usr/lib/php/8.1/php.ini-development
/usr/lib/php/8.1/php.ini-production
/usr/lib/php/8.1/php.ini-production.cli
➜ ~ php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php/7.4/cli
Loaded Configuration File => /etc/php/7.4/cli/php.ini
then i modified the php memory
// [ 1 ]
// /etc/php/7.4/cli/php.ini
max_execution_time = 3600
max_input_time = -1
memory_limit=512M // i have tried set to 2048M or -1 or 99999999999M
then i restart the php and nginx for measure ...
➜ ~ sudo service nginx restart && sudo service php7.4-fpm restart
➜ ~ nginx -s reload
nothing error but still on problem allocate memory stuck on 16384 bytes
so i tried override the setting on index.php its on laravel/index.php and laravel/public/index.php
i put these code and paste into .php file.
<?php
set_time_limit(0);
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 360);
still on problem .
what i was debug is when i tried to set the memory only 512M its alert is guide me to increase more memory ( Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) ) but when i tried increase into 2048M the alerts is a different ( Allowed memory size of 268435456 bytes exhausted (tried to allocate 16384 bytes)
so we can close understand here
for first
please try allocate more 20480 bytes
for second
please try allocate more 16384 bytes.
can anyone explain why ? stuck on 16384 bytes ... what ever i increase to the maximum.
but on my first server with apache its work on configuration and tricky of override instead of index.php apache is use .htaccess.
You edited /etc/php/7.4/cli/php.ini as I did understand it. This is only the config file for your php cli.
Nginx is using /etc/php/7.4/fpm/php.ini
You need to alter your memory limit there

Can't get PHP to allow memory size larger than 536870912 bytes. Magento Script

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

Can't run php artisan commands on laravel

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.

laravel artisan command throwed `Allowed memory size of bytes exhausted` error

In my laravel 5.4 project, I can not run php artisan command. An Allowed memory size of 2097152 bytes exhausted error occured. The website can be view properly in the browser, and laravel.log is also empty, but artisan command in the terminal failed,like this:
➜ laravel git:(dev) ✗ php artisan
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/laravel/vendor/symfony/finder/Finder.php on line 120
It seems like the memory is not enough, I set bigger value for memory_limit,like this:
➜ laravel git:(dev) ✗ php -i |grep memory_limit
memory_limit => 2048MB => 2048MB
But it did not work,could anyone help me, please?
I got this type of error as laravel could not connect to Database. In Laravel 5.4, if database is not connected, it take lot of memory. I think, this is the bug in 5.4.
In general, to increase the memory limit, goto terminal and type
"php --ini".
This will show as
$ php --ini
Configuration File (php.ini) Path: /Applications/XAMPP/xamppfiles/etc
Loaded Configuration File: /Applications/XAMPP/xamppfiles/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
This will show the location of php.ini file in your system.
2) Then open php.ini file in vi search for memory_limit using '/' in command mode. Then edit the line by pressing 'i' and memory_limit=2000:M.
3) press esc and type ":wq" (To save and quit)
Locate your php.ini file by writing php --ini in the console (in my case it is located in /etc/php/7.2/cli/). Open php.ini, locate the line that sets memory_limit, and set it equal to -1 (memory_limit=-1).

PHP memory_limit Won't Increase on CLI

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

Categories