FreeNAS 9.10-U6 migration from ownCloud plugin to Nextcloud plugin

Status
Not open for further replies.

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
Please forgive this newbie question. I am not familiar with how FreeNAS jail works.

I am currently running ownCloud plugin on my FreeNAS. As I t seems nextCloud is where the future development is, I try to migrants from the ownCloud plugin to the nextCloud plugin while keeping the files and accounts intact. However, I have trouble loading the sqlite3 extension in NextCloud.

After added the Nextcloud plugin to the FreeNAS, I stopped the plugin.
Then I copied the data from the default data location from ownCloud jail, /media, to Nextcloud.
Next, I copied the config file, /usr/pbi/owncloud-amd64/www/owncloud/config/config.php, from ownCloud to Nextcloud, /usr/pbi/nextcloud-amd64/www/nextcloud/config/config.php.
I have encountered error 500 when went to the ip of Nextcloud after started the jail.
An error is logged in /var/log/httpd-error.log as
-------------
[Sat Aug 05 22:13:03.627529 2017] [:error] [pid 67700] [client 192.168.27.11:62672] PHP Fatal error: Uncaught exception 'Doctrine\\DBAL\\DBALException' with message 'Failed to connect to the database: An exception occured in driver: could not find driver' in /usr/pbi/nextcloud-amd64/www/nextcloud/lib/private/DB/Connection.php:59\nStack trace:\n#0 /usr/pbi/nextcloud-amd64/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(973): OC\\DB\\Connection->connect()\n#1 /usr/pbi/nextcloud-amd64/www/nextcloud/lib/private/DB/Connection.php(210): Doctrine\\DBAL\\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)\n#2 /usr/pbi/nextcloud-amd64/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): OC\\DB\\Connection->executeUpdate('PRAGMA read_unc...')\n#3 /usr/pbi/nextcloud-amd64/www/nextcloud/lib/private/DB/Connection.php(142): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#4 /usr/pbi/nextcloud-amd64/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver), Object(Doctrine\\D in /usr/pbi/nextcloud-amd64/www/nextcloud/lib/private/DB/Connection.php on line 59
-------------

As I understand, the ownCloud plugin uses sqlite3 as database but the Nextcloud plugin uses MySQL. Hence the sqlite extension for php is missing. I still can't get it work after I have added the following line to /usr/pbi/nextcloud-amd64/etc/php/extensions.ini and copied the /usr/pbi/nextcloud-amd64/lib/php/20121212/sqlite3.so from ownCloud plugin to Nextcloud plugin.
Code:
extension=sqlite3.so

It seems I have missed the dependency files for sqlite3 to work.

Please tell me how to get those dependency installed into the NextCloud jail.

Thanks a ton!

P.S. Yes, I plan to convert to MySQL following the instructions from https://doc.owncloud.org/server/8.0/admin_manual/configuration_database/db_conversion.html after I have get the sqlite php extension worked.

Environment:
Hardware:
HPE Microserver G8 XEON E3 1265L 16GB RAM
Storage:
Pool:
Mirror-0: Toshiba 6TB x 2
Mirror-1: Toshiba 8TB x 2
OS:
FreeNAS-9.10.2-U6 (561f0d7a1)
Plugin:
owncloud-9.1.1-amd64
Manual updated to 9.1.6
nextcloud-10.0.1-amd64
 
Last edited:

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
More info:

I have tried to call sqlite on command line. It worked fine.

Then I modified /usr/pbi/nextcloud-amd64/www/nextcloud/index.php to test with
Code:
date_default_timezone_set('Asia/Hong_Kong');

$db = new SQLite3('/mnt/data/owncloud.db');
$results = $db->query('SELECT * FROM oc_activity;');

while ($row = $results->fetchArray()) {
		var_dump($row);
}

phpinfo();
return;


It worked fine when I browsed to the IP of the Nextcloud server and it showed a long list of rows.
So, the php running on the Nexcloud plugin access SQLite3 without a problem.
Could it be accessing SQLite3 through PDO? I tried again with PDO.

Code:
date_default_timezone_set('Asia/Hong_Kong');

$db = new PDO('sqlite3:/mnt/data/owncloud.db');
$db->setAttribute(PDO::ATTR_ERRMODE,
							PDO::ERRMODE_EXCEPTION);

$results = $db->query('SELECT * FROM oc_activity;');

while ($row = $results->fetchArray()) {
		var_dump($row);
}

phpinfo();

return;


The server threw an error but nothing was logged into /var/log/http-error.log. :(
Code:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /usr/pbi/nextcloud-amd64/www/nextcloud/index.php:32 Stack trace: #0 /usr/pbi/nextcloud-amd64/www/nextcloud/index.php(32): PDO->__construct('sqlite3:/mnt/da...') #1 {main} thrown in /usr/pbi/nextcloud-amd64/www/nextcloud/index.php on line 32


Is Nextcloud using PDO? This error is different from the other I have tried. :confused:
 
Last edited:

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
Unfortunately, no. I have not figured a way to work yet.

Nonetheless, this weekend, I will try to migrate my ownCloud from sqlite to mysql first. Then try to get Nextcloud to use the mysql database from ownCloud plugin.

Finger crossed. I will post an update afterwards.
 
Status
Not open for further replies.
Top