For Those Who Don't Have PDO
A question that usually would appear would be about an error relating to PDO shows up when you visit your freshly uploaded Vanilla 2.0.15 folder. It's obviously not a bug but I don't know where else to post this, but I originally had the question of "why am I getting an error about PDO?"
I wanted to help out by showing a small workaround. This happens because the PDO extension doesn't exist on the servers of your host. If your host, for some weird reason, denies enabling PDO, then there are workarounds available online. I managed to get PHPPDO
to do it.
The error looks like this:
Class 'PDO' not found in /vanilla/conf/config-defaults.php
I downloaded PHPPDO and created a folder called "phppdo" in the root of my Vanilla folder. I then opened /vanilla/library/core/class.router.php and added these lines of code to the top:
function db_connect($dsn, $username = '', $password = '', $driver_options = array(), $path = './phppdo')
$driver = strtolower(trim(substr($dsn, 0, strpos($dsn, ':'))));
if($driver && class_exists('PDO') && extension_loaded('pdo_' . $driver))
$class = 'PDO';
require_once($path . '/phppdo.php');
$class = 'PHPPDO';
return new $class($dsn, $username, $password, $driver_options);
$db = db_connect('mysql:dbname=', 'dbuser', 'dbpass', array(), $_SERVER['DOCUMENT_ROOT'].'/vanilla/phppdo');
} catch(PDOException $e)
For the try statement, I added in my database info after each equals sign and the variables in $db. I'm not sure how to call the variables for $DatabaseName, $DatabaseUser, $DatabasePassword yet. If anyone knows how, please let me know.
After saving that file, I received another error like this one:
Cannot instantiate abstract class PDO in /vanilla/applications/dashboard/controllers/class.setupcontroller.php on line 120
So I opened that file up and went down to line 120 and changed it up:
$Connection = new PDO
Change that to:
$Connection = new PHPPDO
Then I received the same error for /vanilla/library/database/class.database.php. The same fix applies here on line 56:
$this->_Connection = new PDO
$this->_Connection = new PHPPDO
Now you can run Vanilla without PDO installed on your server.
2 · ·