3

I'm creating a server in amazon and I'm having an error that I can not solve.

the image of my error:

enter image description here

For those who do not know the command, it just runs a script for creating tables in the database. I do not understand how a simple routine for creating 50 tables in the database can consume as much resource.

The error occurs when I try to run the command: php artisan migrate I have 50 migrations, but I do not believe the problem is the amount of migrations.

For hours I've been looking for a solution on google, but I can not find. I already tried: memory_limit = 128M in the php.ini file and did not solve the problem

On my local machine everything works perfect. I am using a t2micro (free) machine from amazon aws.

9
  • 1
    Open system monitor and go to the resources tab, re-run PHP and monitor the resources how much is used/you have? Commented Jan 14, 2018 at 23:51
  • 1
    Try this, it works for me. Check the most voted answer: stackoverflow.com/questions/18116261/… Commented Jan 14, 2018 at 23:54
  • 1
    How do other commands work for you like php artisan route:list ? Commented Jan 15, 2018 at 0:01
  • 1
    @RenatoSouzadeOliveira this seems to flag an issue with your installation as my answer indicates. I’ve had this issue before and I had to recreate my Laravel classes using the commands specified below. I had to stop my nginx mysql and other php-Fpm to give composer the server resources to finish the auto load. Once done it ran fine. Commented Jan 15, 2018 at 0:49
  • 1
    Why not try it on a medium or large instance type to see how it behaves? Commented Jan 15, 2018 at 3:37

3 Answers 3

1

Do you have 'swap' enabled in your aws? and what's your PHP version? because there's a same bug in PHP "5.4.11", and also what's composer version?

I first want to say increase your memory limit from php.ini and check the time limit:

memory_limit =  2 GB ?
set_time_limit(0);
ini_set('memory_limit', '20000M');
Sign up to request clarification or add additional context in comments.

2 Comments

I'm using php 7.0.22, Composer version 1.6.2. I will try to increase the time to see what happens.
Since OP is running this on the command line, I think it'd be helpful to note the command line option to avoid the extra step of editting php.ini: $ php -d memory_limit=20000M artisan migrate
1

Solution by OP.

What was causing the problem was a connection drive for mysql. With this command everything worked:

apt-get install php7.0-mysql

Comments

0

Sounds like you have an issue with your laravel installation. This is hard to diagnose without being local to the machine, but try the following commands to clear the cache from composer and laravel:

dump-autoload laravel installation. This regenerates the list of all classes that need to be included in the project

composer dump-autoload

Clear your laravel Installation's cache.

php artisan cache:clear

4 Comments

This seems unlikely - I'd expect an error along the lines of "Could not load class XXX" if this were a problem. Are you aware of something that would be stored in the cache that could cause a memory leak?
@HPierce Something I installed today was the laravel broadcast . The broadcast uses the redis. But I did not even install the redis on amazon server. Does the simple fact of being referenced in the laravel compositor already consume memory?
If you can't even run php artisan route:list then it means your installation has an issue. I have 2 databases (one of those databases is 20GB in size) a python application, and 2 web servers hosts on my t2.micro without issue. try running php in interactive mode (php -a) and run a command like phpinfo() in the php command prompt. If that works, then I'd suspect an issue with your laravel installation.
@RenatoSouzadeOliveira, have you tried the commands I offered? Did they help?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.