NeDi Community
NeDi Software Specific => Database => Topic started by: janet on September 25, 2020, 11:44:03 am
-
I tried setting dbhost to the path to my socket, but it didn't work. Is there a way to use a socket?
-
I haven't considered this scenario yet. How are you running this?
-
Well, I was trying to work around a problem I had with NeDi and my mariadb. Our security folk won't let us run databases on default ports or sockets. While I can define dbhost like this:
dbhost 127.0.0.1:3402
Only nedi.pl works. The web GUI doesn't. Really, all I want is the ability to do this in the config:
dbhost 127.0.0.1
dbport 3402
cactihost 127.0.0.1
cactiport 3402
Right now I use 127.0.0.1:3402 for dbhost and cactihost, and hacked /html/inc/libdb-mysql.php. That said, my solution is ugly - I don't know php, so I just did this:
function DbConnect($host,$user,$pass,$db){
$host = '127.0.0.1';
$port = 3402;
$l = mysqli_connect($host,$user,$pass,$db,$port) or die("Could not connect to $db@$host $port with $user");
mysqli_set_charset($l, "utf8"); # Some stubborn servers need this, tx Nils
return $l;
}
It works, but its an ugly hard coded hack.
-
As long as it works :-) I'll add support for this and packport to NeDi 2.0 Patch3...