Laravel project cannot access database

Hello everyone. I am trying to setup my laravel project on 000webhosting. I created the database and can access it via phpmyadmin. But whatever host I put in my DB_HOST in my .env file I get an error. For localhost connection refused, for 127.0.0.1 wrong stmt prepare parameters received 7. I do not know which host should I put so I can finnaly connect to it. Any help is welcome I am out of ideas now.
Thank you

  1. The server for MySQL is localhost

  2. Please check your username/password again.

  3. Please change your PHP version: cPanel > Settings > General > Change PHP version > 5.6

  4. Please add 'port' => env('DB_PORT', 3306), to your laravel/config/database.php and set the value in laravel/.env like this DB_PORT=3306

Please try again :wink:

Thank you for the reply. I have tried to do it like that with localhost as DB_HOST. I already have the ‘port’ line in database.php but it only gives me connection refused error. I have put these variables again in my .env file and database.php file but I only get internal server error I suppose due to 000webhost being fixed.

This configuration gives me this error
ErrorException in MySqlConnector.php line 124:
Wrong COM_STMT_PREPARE response size. Received 7

I’ve seen countless topics of Laravel not working on free hosting.

Yes I know but I would like to configure it if it is possible in any way just for testing.

But none of the threads have ever solved it being installed so I don’t think it is possible.
Search 000webhost forums latest posts for Laravel you might find something.

Haha I know that too but I was kind of hoping a miracle would come :slight_smile: Basic laravel projects can be uploaded. Also my project has some routes which are accesible on the host so I believe folders are configured good. The only problem is with database connection…

Try Laravel support forums to see if they can change their script to support IPV6 if they do not already.

I will. Thanks for your help