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.
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 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
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).
I am trying to install paypal adaptive accounts API using PHP.
I have set up the developer account, test accounts and app and tested the parameters via the paypal tool. Now I need to install the API on our test site.
I have used How to check if curlSSL is working properly
to ensure I have curl set up.
I followed the instructions here using the PHP tab. I am installing without composer so I connected via an SSL client and used the command as instructed.
curl
https://raw.github.com/paypal/adaptiveaccounts-sdk-php/stable-php5.3/samples/install.php
| php
However I think this repository has been moved and I tracked it down to here.
Meaning my command should be
curl
https://raw.githubusercontent.com/paypal/adaptiveaccounts-sdk-php/master/samples/install.php
| php
I may have found the wrong code because it will not install.
The error output is
composer not installed or 'useComposer' is set to false in install.php.
Running custom installation ...
Downloading adaptiveaccounts-sdk-php - v2.6.106
Downloading sdk-core-php - v1.4.3
Generating autoload file
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in - on line 340
I have checked the install file and the following lines
// Flag to control whether composer should be used for installation
$useComposer = false;
confirm that useComposer is set to false which makes me think I have found the wrong install file.
So does anyone know where the correct location is to point cURL?
Or am I doing anything else wrong? Note the install appears to try to run "custom installation" and fails with a memory error.
Part of this is solved. The install.php file had been removed accidentally .
So you can run
curl -k -L https://raw.github.com/paypal/adaptiveaccounts-sdk-php/stable-php5.3/samples/install.php | php
This gave me a further error
This install script only suppoorts namespace based SDK
So I was directed to a non-namespaced version of of the SDK
curl -k -L https://raw.github.com/paypal/adaptiveaccounts-sdk-php/blob/stable/samples/install.php | php
I then started to get
Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 71 bytes) in - on line 340
So goto fork the file so that you can edit it and assign at the top. I was successful with
ini_set("memory_limit","128M");
This will increase the maximum amount of memory available to PHP to 128 MB for the running script. It is a temporary setting and will only affect the script it is in.
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