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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

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

SS3 and MySQLi - any workaround?


Go to End


6 Posts   2375 Views

Avatar
animasola

Community Member, 121 Posts

16 October 2012 at 4:25pm

It's been a while since I've done work on Silverstripe but I just found out that new installations require the PHP extension mysqli to be enabled. And with all the luck in the world, my hosting provider doesn't have it enabled for re-seller accounts, I was advised to get a VPS account.

Any workaround so I won't need MySQLi enabled? Any downsides as well?

Thanks!

Avatar
Van

Administrator, 25 Posts

17 October 2012 at 8:33am

Hi,

One way would be to use a different kind of DB (PostGRESQL) or alternatively, have your MySQL database hosted on another server. Although, if you were going to do that, you would probably just host everything there?

Sorry I can't be more help. This happened to me once, about 5 years ago and I demanded the host support what I need. It turned out that I wasn't the first person to ask, and they actually did it.

If you can't use MySQLi, and you need it...it's not really a 'reseller' account. They should support your requirements.

Sorry I can't be much more help.

Avatar
Van

Administrator, 25 Posts

17 October 2012 at 8:38am

Edited: 18/10/2012 11:40am

Actually, it would also be possible to modify the framework. Maybe framework/model/MySQLDatabase.php. However MySQLi and MySQL are quite different, with MySQLi having more features, which may end up breaking things in SilverStripe.

Avatar
animasola

Community Member, 121 Posts

17 October 2012 at 7:28pm

Really appreciate your reply Van.

Has MySQLi always been a requirement? I used to host silverstripe apps on the same host and never had any problems. I only encountered the issue when I tried to install 3.0.2. I might try other versions though, like 3.0.1 or 2.x to see if this is an isolated case.

If anyone else encountered the issue and found a work-around, please share! Thanks :)

Avatar
Sean

Forum Moderator, 922 Posts

18 October 2012 at 10:07am

Edited: 18/10/2012 10:10am

mysqli was introduced about a year ago, before 3.0 was released: https://github.com/silverstripe/sapphire/commit/6bf3f7ded400c925dd66df2c2612c095d447c7b0#model/MySQLDatabase.php

2.4.x still uses the old mysql functions, it was upgraded during the course of 3.0 development because the majority of shared hosts we found had enabled mysqli by default. PHP have also suggested that everyone switches to mysqli or PDO MySQL instead of the old functions because they are not actively maintained any longer.

Excerpt about the old mysql API taken from http://nz.php.net/manual/en/intro.mysql.php:

"This extension is not recommended for writing new code. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API."

I would suggest to your host that they enable mysqli, especially considering PHP themselves recommend everyone use it over the old driver. For the most part, I don't see that being a problem for them, because mysqli will run happily alongside the old mysql drivers.

Thanks,
Sean

Avatar
animasola

Community Member, 121 Posts

18 October 2012 at 5:48pm

Thanks for the clarity Sean. I guess the best move would be to persuade my host to have the extension enabled.

Appreciate all the help!