Reputation: 593
I have a larvael and I want it to make it in production. I have a server hosting and database on infomaniak.com.
I have upload all my file and I get a SQL timeout error :
SQLSTATE[HY000] [2002] Connection timed out (SQL: select * from
characters
wherechecked
= 1 order by RAND() limit 1)
I have an other Laravel website on infomaniak and don't have this problem. I have check my .env
file, my /config/database
file and try php artisan config:clear
or php artisan cache:clear
. I also try to dump DB:connection()
and the connection information are right.
I can connect to my homestead database in local and work fine. But when I try to connect to the SAME database than my other website with the same .env
file and still have the timeout error.
How can I fix this ? Are there a way to clear another cache ? Completly lost :/
EDIT :
If i try :
if(DB::connection()->getDatabaseName()) {
echo "Yes! successfully connected to the DB: " . DB::connection()->getDatabaseName();
}
The page return Yes! successfully connected to the DB: db_name
EDIT 2 :
I just see my hosting server is in PHP 5.6 but it say that's my website is in PHP 7. Really confusing but maybe this informations is important (have another laravel on this server and works like that)
Upvotes: 1
Views: 1410