MYSQL not working in shared hosting..

Published 1 year ago by amitshrestha221

I am working with Laravel 5.3 which required PHP 5.6.4. In my server there is only option for 5.6.3 or 7.0

When I select 5.6.3 using Multi PHP Manager in cpanel for the domain, mysql connection works and returns value when i wrote simple code for testing connection:


    $conn = mysqli_connect('localhost','amplesho_admin', '1#Ampleadmin', 'amplesho_ampleshop1') or die('Database Error');

        echo "success";
        echo "failed";

While selecting 5.6.3 it returns success. But when i select 7.0, it returns nothing. I'm on a shared hosting.


based on your operating system , i assume you did not enable your mysqli module in your php 7.

to fix that , go to your php configuration directory , find php.ini , uncomment the module line , restart your server.

you might run a quick test by writing a php file contains phpinfo(); in it , check if mysqli or other mysql works , pdo or something.

if you did not install your php properly , please add some module . on mac or unix , it is easy , but on windows , really tricky.....

good luck

Please sign in or create an account to participate in this conversation.