Laravel Solutions | Allowed Memory Size Exhausted Try to Allocate 262144 bytes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to the laravel solution series so today in this series we are going to discuss about this problem so this is a problem browse php allowed memory size so hope you are familiar with this one because this is a php error so it's about uh you need to increase your ram size not ram size it's the memory size okay so i am struggling to fix out this from many hours so that's why i'm sharing with you so hope this will help you in the future features projects okay so i'm running this so i have created this game seeder this one not game seeder i opened the user seeder so it's a simple user table where i'm creating a master user and a simple user so it's a simple user seeder right and i'm executing this user seeder in this run method right so i can also add this in an array format right to run multiple seeders so i'm doing this for demonstration purposes so that's why i added this without the array so after doing this we will add this in the array so you can execute the multiple seater at once okay so i added this user seeder here so whenever whenever i'm going to execute this so it's throwing the error what's the error so let's hit enter so it's throwing the same error that allowed memory size and i'm changing the memory size from five one two to two zero four eight so let me open the cmd and uh let me tell you that how you can open your env file php and env file so don't need to change any directory just type php.ini so it will open the php ini value and let's find the memory and yes this memory limit is defined and 512 is a very huge memory so you don't need to increase the size because if you increase the size it's not going to work so how to solve this issue and first discuss that what's the issue so basically issue is that we are calling a run method and in the run we are executing this run method so it's creating the recursion so it means that function is calling itself so this is very wrong so it's called recursion and it's so execute this infinite time so that's why it's creating this recurrion and throwing us allowed memory size of exception so if i change this from run to call so now it's going to execute this seeder so let me clear this out and execute this and i open this database and yes now it's seated so let me open the database here and give it a refresh and yes our users are seated right so how you can remove this exception by using this call method instead of run so how you can execute the multiple seeder at once so type array here and add them here so let me identify it properly so i added this simple user so let me add this uh game seeder here so this would be my text user is not suggesting me so i think i added this already at the top so it's a class so let me check that oh no i added this model straight so i don't need to mention this okay so now let's uh let me open the database first for you so it's uh i'm sitting the games so let me open the what is the name of this one games okay so there is no game so let's go here and execute this db seed so now it's going to see this and yes it's done so let's give it a refresh and yes we have added it's added two games so it means that our seeder is working properly so we solved our issue so what's the issue it's uh throwing the allowed memories ahead of exception so we fix this issue by changing this so method of call right so let me introduce you with the series so i'm shooting the videos on the laravel so i have a different playlist on the laravel so you can check out them but this one is special laravel solutions where i am discussing the problems of the laravel and then i am providing the solution so you can get the problems you can get the problem solutions from this channel and you can also get the regular updates from this channel i am uploading the lyric daily laravel tips and tricks so how you can get this variable in the php how to do this and there is much more things right so subscribe the youtube channel and stay connected bye
Info
Channel: Career Development Lab
Views: 8,420
Rating: undefined out of 5
Keywords: career development lab, cdl, web development, learn web development, full stack development, back end development, web dev, app development, website application development, allowed memory size of bytes exhausted, allowed memory size of 536870912 bytes exhausted, allowed memory size eception in laravel, laravel tips, php allowed memory size exhausted, php memory exhausted, increase allowed memory size in php, allowed memory size of 41943040
Id: Fw6CuFjajwo
Channel Id: undefined
Length: 4min 55sec (295 seconds)
Published: Wed Aug 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.