Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing port for db connection #602

Open
Spartancake opened this issue Apr 29, 2024 · 1 comment
Open

Changing port for db connection #602

Spartancake opened this issue Apr 29, 2024 · 1 comment

Comments

@Spartancake
Copy link

Hi, I've been trying to install the container and everything works fine, but at the installation part there's not an option for the port for the connection for the db, since I'm using my own db on a different port and not in a container instead of the one in the compose file (which I've removed from the file), I would like to ask what do I need to add to change the port for the connection to the db.

Thanks in advance

@Legalistas
Copy link

in App\Core\Database.php change tryConnection

public function tryConnection(string $host = '', string $user = '', string $pass = null, int $port = 3306): bool
{
    try {
        if (empty($host) or empty($user)) {
            return false;
        }

        $this->connection = new mysqli($host, $user, $pass, '', $port);

        if ($this->connection->connect_error) {
            return false;
        }

        // force utf8 to avoid weird characters
        $this->connection->set_charset('utf8');

        return true;
    } catch (Exception $e) {
        return false;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants