Welcome Guest, Not a member yet? Register   Sign In
An uncaught Exception was encountered
#4

So I solved the problem but its a terrible solution. I made a change in the frameworks system code and it works like a charm.

File: /vendor/codeigniter4/framework/system/Database/MySQLi/Connection.php

I changed this code:
Code:
public function connect(bool $persistent = false)
    {
        // Do we have a socket path?
        if ($this->hostname[0] === '/') {
            $hostname = null;
            $port    = null;
            $socket  = $this->hostname;
        } else {
            $hostname = ($persistent === true) ? 'p:' . $this->hostname : $this->hostname;
            $port    = empty($this->port) ? null : $this->port;
            $socket  = '';
        }

To this :
Code:
public function connect(bool $persistent = FALSE)
    {
        // Do we have a socket path?
        if($this->hostname[0] === '/')
        {
            $hostname = NULL;
            $port = NULL;
            $socket = $this->hostname;
        }
        else
        {
            $hostname = ($persistent === TRUE) ? 'p:' . $this->hostname : $this->hostname;
            $port = empty($this->port) ? NULL : $this->port;
            $socket = '/Applications/MAMP/tmp/mysql/mysql.sock';
        }

Essentially it was the socket having an empty string that was the problem. I hope there is a better way to set this setting that I just don't know about.
Reply


Messages In This Thread
RE: An uncaught Exception was encountered - by ChicagoPhil - 03-20-2022, 12:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB