Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

MySQL Port BUG?


Reply


7 Posts   1632 Views

Avatar
n0ne

Community Member, 18 Posts

3 August 2012 at 11:55pm

Hi. I had a weird situation, i tried to run silverstripe using non-default port, and i couldn't connect, only default 3306 worked. I'm wondering is it a some kind of bug? Is there a way to run ss with mysql on different port than the default one?

Avatar
Willr

Forum Moderator, 5513 Posts

4 August 2012 at 6:33pm

In 2.* or 3.0? It looks like the 3.0 code doesn't allow you to pass a port number as a configuration option - which seems a bug. Though you should be able to use this in your _ss_environment file (or site custom php.ini) to change the default port

ini_set("mysqli.default_port", 42)

Avatar
n0ne

Community Member, 18 Posts

5 August 2012 at 3:51am

I'm using 3.0.1.
Neither of your suggested solutions of your solutions works. The mysql is on a different server and I don't have access to change the php.ini stuff, and for the _ss_enviroment file it seems that it behaves exactly the same as before (putting the data into the form).

"I couldn't find a database server on 'XXXXXXX:3307': Unknown MySQL server host 'XXXXXXX:3307' (2)"

I also chekd that db is fine using mysql_connect('XXXXX:3307',.....); in external file.
Any other ideas?

Avatar
Willr

Forum Moderator, 5513 Posts

5 August 2012 at 9:22am

the _ss_enviroment file it seems that it behaves exactly the same as before (putting the data into the form).

Make sure then that it is using / reading that code (using a die() or similar) to ensure that your changes are being read.

The only other solution I would suggest is to work on adding port support for the mysqli constructor. (https://github.com/silverstripe/sapphire/blob/3.0/model/MySQLDatabase.php#L56). It seems like server.com:port behaves differently in mysqli than to mysql, hence the need to pass it as a separate port argument.

Avatar
n0ne

Community Member, 18 Posts

5 August 2012 at 3:27pm

Yea, You were right, there's additional parameter if you want to use different port in mysqli. Since it's not a big problem I thought that I could fix it and submit the code to You.

Avatar
qlex

Community Member, 68 Posts

11 April 2014 at 5:35pm

Hey.
have the same problem. Both mysql5.5 and postgresql 8.3 use other ports 3307 and 5433) so i cant install silverstripe.
did anyone made a change to installation script so that this alternative port could be used?

Avatar
CrazyProgrammer

Community Member, 2 Posts

10 September 2014 at 7:37pm

Hi,
Go to .htaccess and add line => php_value mysqli.default_port 3307
That`s all, worked fine for me.