Jump to:

4922 Posts in 7220 Topics by 1473 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » SS3 and MySQLi - any workaround?

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

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

Page: 1
Go to End
Author Topic: 676 Views
  • animasola
    Avatar
    Community Member
    121 Posts

    SS3 and MySQLi - any workaround? Link to this post

    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!

  • Van
    Avatar
    Administrator
    25 Posts

    Re: SS3 and MySQLi - any workaround? Link to this post

    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.

  • Van
    Avatar
    Administrator
    25 Posts

    Re: SS3 and MySQLi - any workaround? Link to this post

    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.

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: SS3 and MySQLi - any workaround? Link to this post

    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

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: SS3 and MySQLi - any workaround? Link to this post

    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

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: SS3 and MySQLi - any workaround? Link to this post

    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!

    676 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.