Laravel connection problems with MySQL

I’ve just started working on a new site in Laravel, and I’m having trouble with connections to a MYSQL (5.5.25a) database. The mysql server is on the same local network, but on a different machine to the web server. This set up has been working fine for me in Codeigniter, YII, straight up PHP, etc, for a long time.

I’ve set up Laravel’s /config/database.php with my database credentials, however the site times out whenever its on a page that makes a database connection using Laravels database classes. It gives me the dreaded Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. error in chrome.

If i enter the credentials incorrectly (wrong password/username/dbname), Laravel gives me some real MYSQL error messages SQLSTATE[28000] [1045] Access denied for user..., so it seems it can reach the server fine.

If I do a quick and dirty database call using mysqli and log the result with chromePHP, everything appears to work fine, and it returns the correct number of rows from the database, no timing out, no problems.

$mysqli = new mysqli('', 'username', 'password', 'dbname');

if ($mysqli->connect_error){
    die ("Connect error: " . $mysqli->connect_error );

if ($result = $mysqli->query("SELECT username FROM user LIMIT 10")) {
    /* free result set */

Why could Laravel be timing out when I try to use the provided database classes?

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.