Open jakebiesinger opened 11 years ago
I think this error is caused by the PHP process not being able to create the session file. Line 151 in /extra/cbcl0/users/dokuwiki-2012-10-13/inc/init.php
is a call to session_start()
and looking at the pasted error it looks like it attempted to create /var/lib/php/session/sess_pcafi9ojl9vbglfu0vpbett572
but failed with a permission denied error. Are you running this manually from the command line as a different user than what's used for your web server?
I'm running from the command line as the same user as the mediawiki server, but a different user to the dokuwiki process (switching from one server to another). I don't have root on this machine so it shouldn't be able to create anything in /var/lib/php/...
Is there a way to specify, e.g., a different mysql.conf file?
Start with the session save path first. Change src/MediaWiki2DokuWiki/index.php
to add a call to session_save_path() and see if that addresses the session file creation and MySQL issue:
session_save_path('/tmp');
require 'settings.php';
require 'autoload.php';
new MediaWiki2DokuWiki_Environment($settings);
After updating as above, the error message is slightly different but the socket is still incorrect:
$ php index.php
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)
I also tried setting the default socket manually:
session_save_path('/tmp');
ini_set("mysql.default_socket", "/tmp/mysql.sock");
require 'settings.php';
require 'autoload.php';
new MediaWiki2DokuWiki_Environment($settings);
with the same error message.
That's progress anyway. Try changing the way it connects to the database. Change the dbConnect()
function in src/MediaWiki2DokuWiki/MediaWiki/Settings.php
to the following:
public function dbConnect()
{
$dsn = $this->settings['wgDBtype'] . ':'
. 'dbname=' . $this->settings['wgDBname'] . ';'
. 'unix_socket=/tmp/mysql.sock';
return new PDO(
$dsn,
$this->settings['wgDBuser'],
$this->settings['wgDBpassword']
);
}
If that resolves the MySQL error then I can look into making this change permanent by conditionally building the DSN.
Hey, slick. Looks like that did it. My wiki is converting now. I'll let you know if there are any issues!
Please try the latest version. I've modified it to be aware of MySQL sockets.
I have just downloaded 0.3.5 today and this appears to still be a problem. I tried the suggestions here to no avail so far. I have an old mediawiki that has been upgraded to 1.22.6 and an empty instance of the latest version of dokuwiki:
php index.php SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I also tried 0.3.6, same result.
I'm running Mediawiki 1.16.0 with the latest Dokuwiki (downloaded last week). My mediawiki LocalSettings.php include the following lines:
Unfortunately, when I try to run the converter's index.php, the converter complains about not reaching mysql on /var/lib/mysql/mysql.sock:
Perhaps my save_path is off? Perhaps I need to change a setting in settings.php?
Thanks for your help!