uvdesk / community-skeleton

UVdesk Opensource Community Helpdesk Project built for all to make a Full Ticketing Support System along with many more other features.
https://www.uvdesk.com
MIT License
8.24k stars 456 forks source link

Can not connect to database although credentials are correct #364

Closed Turab closed 3 years ago

Turab commented 3 years ago

Downloaded the latest version right now, extracted it to a www directory in a Centos LAMP. Setup script passes prerequisite test and comes to database screen; although the information is correct, it still cannot connect to database by saying:

Details are incorrect ! Connection not established.

vaishaliwebkul commented 3 years ago

@Turab once verify your host server and port of database then check again.

Turab commented 3 years ago

@vaishaliwebkul Thank you for taking time to respond, but as I said, credentials and information are already correct as with exact same data I can connect to DB and do CRUD operations. For testing I put a simple PHP file into the Uvdesk directory, with the same server information and a piece of code like:

$conn = mysqli_connect('localhost', user, password, database_name); // No port provided as it is default already
mysqli_query($conn, "CREATE TABLE...");

And without an error it created the table. How do you think I can further debug this?

Turab commented 3 years ago

I debugged the issue by dumping the thrown exception and saw that Uvdesk is trying to connect to a Redis server for a reason I don't understand. The exeption said "connection refused" which I realized was perfectly normal because Redis is not installed on this server. So I disabled PHP Redis plugin and installation process could continue. There is also a discussion in community about this. I believe this is a valid bug.

papnoisanjeev commented 3 years ago

@Turab

which is perfectly normal because Redis is not installed on this server. I disabled PHP Redis plugin and installation process could continue. There is also a discussion in community about this. I believe this is a valid bug.

Please mention where you have made changes with detail explanation so that it will help to others to do the same.

Turab commented 3 years ago

@papnoisanjeev as I said, I just disabled Redis extension of PHP by commenting out "extension=redis" line in php.ini. Another approach can be editing the file /uvdesk/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php and commenting out this whole block:

          elseif (extension_loaded('redis')) {
            $redis = new Redis();
            $redis->connect('127.0.0.1');

            if (class_exists(RedisCache::class)) {
                $cache = new RedisCache();
                $cache->setRedis($redis);
            } else {
                $cache = new RedisAdapter($redis);
            }
}
xAurai commented 3 years ago

I also encountered this issue during setup. I tested credentials in MySQL Workbench and successfully connected.

I am using Plesk and disabling the Redis PHP extension I was also able to continue to the next part of the setup.

papnoisanjeev commented 3 years ago

@Turab @xAurai

Thanks !!

jxs714 commented 2 years ago

@papnoisanjeev as I said, I just disabled Redis extension of PHP by commenting out "extension=redis" line in php.ini. Another approach can be editing the file /uvdesk/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php and commenting out this whole block:

        if (extension_loaded('redis')) {
            $redis = new \Redis();
            $redis->connect('127.0.0.1');

            $cache = new \Doctrine\Common\Cache\RedisCache();
            $cache->setRedis($redis);

            return $cache;
        }

Thank you so much for this. This fixed the issue!

BlackDahlia313 commented 2 years ago

I am having this issue, but redis is not installed.