Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
For Those Who Don't Have PDO
Shadowdare
MVP
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:
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:
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:
So I opened that file up and went down to line 120 and changed it up:
Find:
Change that to:
Then I received the same error for /vanilla/library/database/class.database.php. The same fix applies here on line 56:
Change:
To:
Now you can run Vanilla without PDO installed on your server.
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';
}
else
{
require_once($path . '/phppdo.php');
$class = 'PHPPDO';
}
return new $class($dsn, $username, $password, $driver_options);
}
try
{
$db = db_connect('mysql:dbname=', 'dbuser', 'dbpass', array(), $_SERVER['DOCUMENT_ROOT'].'/vanilla/phppdo');
} catch(PDOException $e)
{
die($e->getMessage());
}
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:
Find:
$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:
Change:
$this->_Connection = new PDO
To:
$this->_Connection = new PHPPDO
Now you can run Vanilla without PDO installed on your server.
Add Pages to Vanilla with the Basic Pages app
2
Comments
Add Pages to Vanilla with the Basic Pages app
SQLSTATE[HY000] [1045] Access denied for user 'dbuser'@'localhost' (using password: YES)
what now ?
$db = db_connect('mysql:dbname=', 'dbuser', 'dbpass', array(), $_SERVER['DOCUMENT_ROOT'].'/vanilla/phppdo');
Add the dbname after the equals sign and change dbuser and dbpass. Also, make sure that the path to the phppdo is correct.
Add Pages to Vanilla with the Basic Pages app
I have just used these mods to run Vanilla2 on my MoWeS local host.
I was wondering if anyone has experienced any adverse affects from making these changes?
Add Pages to Vanilla with the Basic Pages app
$db = db_connect("mysql:host='your_hostname';dbname=", 'dbuser', 'dbpass', array(), $_SERVER['DOCUMENT_ROOT'].'/vanilla/phppdo');
Parse error: syntax error, unexpected T_TRY, expecting T_FUNCTION
Any ideas?
For v2.0.18.1 some of the info has changed:
in /vanilla/library/database/class.database.php
in /vanilla/library/core/class.router.php
in /vanilla/applications/dashboard/controllers/class.setupcontroller.php
Also, if you muck up the install along the way, you may have to empty the database (drop all the tables) and delete the /conf/config.php file.
For v2.0.18.2 some of the info has changed:
in /vanilla/library/database/class.database.php
require_once($_SERVER['DOCUMENT_ROOT'].'/external/vanilla/phppdo'. '/phppdo.php');
on line 29in /vanilla/library/core/class.router.php
in /vanilla/applications/dashboard/controllers/class.setupcontroller.php
Also, if you muck up the install along the way, you may have to empty the database (drop all the tables) and delete the /conf/config.php file.
I seem to get timeout errors though when trying it with remote sites (rather than a local test site)
I now get this... Fatal error: Undefined class constant 'PDO::ATTR_DEFAULT_FETCH_MODE' in /home/emily/public_html/vanilla/phppdo/phppdo.php on line 361
Any advice?