Announcement

  •  » Engine
  •  » [2.5] mysqli and specific port number

#1 2013-04-02 14:12:35

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

[2.5] mysqli and specific port number

I use a specific port number for a connection over SSH tunnel. On PHP side, instead of using host=localhost, I use host=127.0.0.1:3307

In include/dblayer/functions_mysqli.inc.php I had to change the code this way to make it work:

Code:

  if (strpos($host, ':') !== false)
  {
    list($host, $port) = explode(':', $host);
  }
  else
  {
    $port = null;
  }

  $mysqli = new mysqli($host, $user, $password, null, $port);

We could also have a simpler code and an optional $conf['db_port'] = 3307; in database.inc.php

I think it will be a problem if we try to have this work and also [Forum, post 141385 by fisharebest in topic 21661] v2.5 upgrade script fails due to lack of support for mysql sockets

mistic100 (and others) what is your opinion?

Offline

 

#2 2013-04-02 14:54:25

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [2.5] mysqli and specific port number

that's why I asked for the various syntaxes possible :)

I would prefer to find a way to automate it

Offline

 

#3 2013-04-02 16:12:52

nicolas
Former Piwigo Team
2004-12-30
1232

Re: [2.5] mysqli and specific port number

Two ideas :
1) - add an optional port (with a default value)
    - add an optional socket support

2) use a data source name (DSN) for advanced user.
http://pear.php.net/manual/fr/package.d … ro-dsn.php

The idea is to allow advanced people to use their specific installation and describe it in a standard way. And the other idea is to let less advanced people to give database informations as easy as possible.

The two solutions involve a modification of the installation web step. We can imagine that the surnumeral fileds can be hidden by default and a checkbox show them with a label "advanced users"

My 2 cents.

Offline

 

#4 2013-04-03 17:01:59

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [2.5] mysqli and specific port number

mistic100 wrote:

I would prefer to find a way to automate it

I agree, no need to change install screen for 0.001% of users.

host = /path/to/socket => substr($host, 0, 1)=='/'
host = 1.2.3.4:3405 => port 3405
host = localhost

Offline

 
  •  » Engine
  •  » [2.5] mysqli and specific port number

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact