BramVanhoutte's avatar

Moving from SQLite to MySQL causes error 500

I am making this project for school using Laravel. I started off using SQLite, but the assignment changed and they now want us to use MySQL. After switching from SQLite to MySQL I get an error 500 status page in the browser and the following errors in the NginX output. I am using Laradock.

nginx_1                | 2018/05/26 14:25:18 [error] 7#7: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php on line 67

nginx_1                | PHP message: PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 73728 bytes) in /var/www/vendor/composer/ClassLoader.php on line 444" while reading response header from upstream, client: 172.19.0.1, server: localhost, request: "GET /dashboard HTTP/1.1",upstream: "fastcgi://172.19.0.3:9000", host: "localhost:8080"

nginx_1                | 172.19.0.1 - - [26/May/2018:14:25:18 +0000] "GET /dashboard HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"

When going to the page it doesn't show me the usual Laravel error-page. But instead, it shows me the chrome error 500 page.

The only files I changed to start using MySQL is the database.php file in the config folder. My migrations and seeds are working, so the database has the right tables and contains data.

Does anyone know how to get my program working? I read a few things about changing the memory_limit in php.info but it is already set to -1 and changing it doesn't seem like a solution.

0 likes
1 reply
ejdelmonico's avatar
Level 53

First off, Laravel is designed so that you do not need to change default values in the config directory. You should declare the correct values in the .env file. Laravel reads the .env file first and then caches the values for future reference. So, I would run all of the artisan commands to clear caches and also clear your browser cache.

Please or to participate in this conversation.