How can I allowed more memory for laravel - php

I have just installed Laravel on my web server but after I run the php artisan serve command and navigate to my server's Laravel URL I am getting this error:
[Tue Oct 15 11:38:54 2019] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 77824 bytes) in /Users/apple/eAT/vendor/composer/ClassLoader.php on line 444

You can increase the memory allocation to PHP by editing the memory_limit variable in php.ini file.
Alternatively, you can edit the .htaccess file and add php_value memory_limit 256M to set memory limit for specific application where 256 is the memory allowed to the application. This, however, isn't tested by me.
You may need to restart your PHP server.

Related

PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes)

I know this is a repeated question, but I couldn't find a solution after trying all the answers discussed here.
When I run php bin/magento setup:upgrade command, it shows error like
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/mysite/vendor/paragonie/sodium_compat/lib/sodium_compat.php on line 214
Modified memory_limit value in php.ini file, but still issue exists. Any other solutions for this problem?
Make sure you edited the correct php.ini.PHP executed via the web server, and run via command line, often use two different ones
Just add this below line to before line of you getting error in your file
ini_set('memory_limit', '-1');
It will take unlimited memory usage of server.
OR
in yourr PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
If you don't have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M
The simplest way to do this, without the need to change your config is to specify the memory limit when you run the command.
php -dmemory_limit=-1 bin/magento setup:upgrade

Laravel reporting memory size 268MB exhausted but php.ini says 512MB

Laravel job listener is running over 10s of thousands of records, and giving the error
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1179648 bytes) in .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php on line 184
[Symfony\Component\Debug\Exception\FatalErrorException]
Allowed memory size of 268435456 bytes exhausted (tried to allocate 1179648 bytes)
I have proven using phpinfo() that the memory_limit = 512M, so I'm at a loss as to what is happening when 512 > 268 :) - also what has belongsTo relationship got to do with it ?
You mention Laravel job listener which make me assume that you run it through command line. php.ini for command line execution may be different than what web server load. Please make sure the memory_limit value are same for both php.ini. To find where php.ini for command line, from shell (assuming Linux), run
$ php -i | grep php\.ini

php file run as a cron exceeds memory allocation - works fine in browser

I have a php file that I can run fine by visiting the url in a browser but if I try to run it as a cronjob or via PuTTY then I get the following error:
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/admin/bv_cron.php on line 215
I've updated the following php.ini files:
/etc/php5/apache2 and /etc/php5/cgi
both having set memory_limit to 1024M
There are no htaccess files that alter this and no "local" php.ini files.
Apache has been restarted and the server (ubuntu) has been rebooted.
1024M is far larger than the 262144 bytes so is it not recognising this value? (the server has a max of 3GB of memory).
What could the possible issues be?
--edit--
There was a MySQL query in this file - even when this was removed to test if this was taking up memory it still came out with the error.

Magento install php memory error

I'm trying to install magento (1.8.0.0) inside a VM (Debian7 x64) for testing purposes.
When I try to open localhost/magento i get a php mermory error.
Magento reccomends a php memory limit of 512MB. I've increased this value even to 4096MB but the error still remains:
Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 130968 bytes) in /var/www/magento/app/code/core/Mage/Core/Model/Resource.php on line 199
a phpinfo()-file shows me memory_limit=4096.
Moreover I've set
php_value memory_limit 4096M
inside the .htaccess
Can anyone helm me out with this?
Thanks

Fatal error come when using TCPDF

when using TCPDF
it show following fatal error
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 16 bytes) in D:\wamp\www\tcpdf\unicode_data.php on line 7833
how i fix that error-
my php version is PHP version :5.2.5
Apache version :Apache/2.2.6 (Win32)
That means that 8 Mb of RAM isn't enough for your PHP script, that generate PDF file.
Go to your php.ini, find "memory_limit" and change that line to something like that:
memory_limit = 256M;
After that, restart your Apache.

Categories