Advertisement:

Author Topic: PROB HOST Install Osclass and Define PORT  (Read 2870 times)

Guib

  • Jr. Member
  • **
  • Posts: 92
PROB HOST Install Osclass and Define PORT
« on: February 08, 2016, 08:09:09 pm »
Hi, excuse to post on the forum this message.

I have a problem with the install of Osclass
I'm on OVH (hosting site).

There are change the sql privé (private SQL) and now, when we want to create a new website, we must writte the PORT (define port).
I have see on the forum two solutions but they don't work…
The fisrt was go to the osclass files oc-include and ad code… Nothing, the second juste ad after the name of host ": and numbers of PORT" (as :12345) but nothing too…

Anybody have the same problem or have an OVH hosting site with a SQL Private "Docker"?

Thanks for Helping

GuiB

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: PROB HOST Install Osclass and Define PORT
« Reply #1 on: February 08, 2016, 08:32:01 pm »
Hi,

Try this:

oc-includes/osclass/classes/database/DBConnectionClass.php

Replace this block:

Code: [Select]
        function _connectToDb($host, $user, $password, &$connId)
        {
            if( OSC_DEBUG ) {
                $connId = new mysqli($host, $user, $password);
            } else {
                $connId = @new mysqli($host, $user, $password);
            }

with:

Code: [Select]
        function _connectToDb($host, $user, $password, &$connId)
        {
            if( OSC_DEBUG ) {
                $connId = new mysqli($host, $user, $password, DB_NAME, '12345');
            } else {
                $connId = @new mysqli($host, $user, $password, DB_NAME, '12345');
            }

Of course change 12345 to your real MySQL port.

Regards

Guib

  • Jr. Member
  • **
  • Posts: 92
Re: PROB HOST Install Osclass and Define PORT
« Reply #2 on: February 08, 2016, 09:01:37 pm »
Hi Tesso Thanks for your rapidity.

I have test but nothing, always the same message :
Osclass database server is not available. Need more help?

I don't understand why…

whith another Private SQL all is ok.
Here, it's a Private SQL "Docker".
Whith the "Legacy" all was Ok

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: PROB HOST Install Osclass and Define PORT
« Reply #3 on: February 08, 2016, 09:24:50 pm »
???

Sorry, I know nothing of that technology. Wait for someone familiar with it or ask to OVH if you can set default port 3306 for you Docker. ???

REgards

Guib

  • Jr. Member
  • **
  • Posts: 92
Re: PROB HOST Install Osclass and Define PORT
« Reply #4 on: February 08, 2016, 09:39:29 pm »
Thanks Tesso.

I don't know if it's Osclass or Docker cause I have test to install on a subdomain a Wordpress and after ad to the HOST :PORT it work…

Thanks again.

Regards.

GuiB ;)

Guib

  • Jr. Member
  • **
  • Posts: 92
Re: PROB HOST Install Osclass and Define PORT
« Reply #5 on: February 09, 2016, 09:18:02 am »
I WINNNNNNNNNNN YOUHOUUUUU

If another guy have the same problem with OVH HOST and private SQL DOCKER : the solution :

Before, big thanks to Teseo :

On the file on oc-include :

function _connectToDb($host, $user, $password, &$connId)
        {
            if( OSC_DEBUG ) {
                $connId = new mysqli($host, $user, $password, DB_NAME, '12345');
            } else {
                $connId = @new mysqli($host, $user, $password, DB_NAME, '12345');
            }

Put the real name of the DB_NAME and real numbers of PORT

Yesterday I changed juste the number of PORT and no add the name of database. With the name of the BDD it work.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: PROB HOST Install Osclass and Define PORT
« Reply #6 on: February 09, 2016, 09:27:32 am »
This seems to be omission in the core, rarely MySQL is not using default port, but there should be support for custom value.

I will have opened an issue here: https://github.com/osclass/Osclass/issues/2004

This should be manageable via installation and config.php, without core modifications.

Regards
« Last Edit: February 09, 2016, 09:29:56 am by dev101 »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: PROB HOST Install Osclass and Define PORT
« Reply #7 on: February 09, 2016, 01:05:17 pm »
You're welcome, glad you solvedt it. :)

Quote
Put the real name of the DB_NAME

Weird, because constant DB_NAME is usually defined in config.php: ???

Code: [Select]
/** MySQL database name for Osclass */
define('DB_NAME', 'database_name');

Regards

Guib

  • Jr. Member
  • **
  • Posts: 92
Re: PROB HOST Install Osclass and Define PORT
« Reply #8 on: February 10, 2016, 04:52:22 pm »
I test yesterday without the name of the DB and it's good…

Maybe it will be necessary for install… Now I rewrite DB_NAME

I understand nothing. It work and It's ccool :)

Mystery of code ;)

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: PROB HOST Install Osclass and Define PORT
« Reply #9 on: February 12, 2016, 12:20:18 pm »
Maybe it will be necessary for install… Now I rewrite DB_NAME

Exactly, since during installation config.php does not exist yet, so the constant is not defined.

Regards

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: PROB HOST Install Osclass and Define PORT
« Reply #10 on: November 04, 2016, 11:24:16 pm »
Carlos pointed us to an older blog post, there is no need to modify core files for MySQL with custom port.
Simply define host:port for DB_HOST in config.php:

https://dev.osclass.org/2012/10/22/mysql-alternate-port-number/

But, it still could be a problem during installation...
« Last Edit: November 04, 2016, 11:25:47 pm by dev101 »