Upon trying to run some migrations in FuelPHP via command line with Oil I ran into this error message containing the error
Uncaught exception Fuel\Core\Database_Exception: No MySQLi Connection
I discovered that when running from the command line my normal php.ini was not being run. PHP was using the defaults, including the default mysql socket which was in the wrong place.
Solution
In my case I created a symlink to redirect which seems to have done the trick. I am running Mamp on OS X in default locations so your directories may differ.
There may be a better fix and this may be a symptom of something else being ‘off’. I initially created a /etc/php.ini with the proper socket location directive but this did not work out properly, possibly due to permissions or something.
In my case I was trying to get PHP playing nicely with my FuelPHP app running on Apache under FCGId configured via Virtualmin. My .htaccess looked like:
Alternatively you can also get it to work WITHOUT adding in the question mark by changing from FCGid to CGI (if configuring via Virtualmin: Server Configuration: Website Options: PHP script execution mode from “FCGId” to “CGI wrapper”) but if you want it to work in FCGid mode you will need the question mark. I do not know why this is the case though.
Dustin Bolton – Software Engineer, Web & WordPress Developer