diff --git a/lib/migrate.php b/lib/migrate.php
index 2730d26a74a03c6a6160594e8c229bd1f899b30f..a8a5e581c3af9abfd0e13793839c2af363d7d2f2 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -496,10 +496,14 @@ class OC_Migrate{
 			$datadir = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
 						
 			// DB type
-			if( !is_callable( 'sqlite_open' ) || !class_exists( 'SQLite3' ) ){
+			if( class_exists( 'SQLite3' ) ){
+				$dbtype = 'sqlite3';
+			} else if( is_callable( 'sqlite_open' ) ){
+				$dbtype = 'sqlite';	
+			} else {
 				OC_Log::write( 'migration', 'SQLite not found', OC_Log::ERROR );
 				return false;
-			}	
+			}
 
 			// Prepare options array
 			$options = array(
@@ -510,7 +514,7 @@ class OC_Migrate{
 				'quote_identifier' => true
 				);
 			$dsn = array(
-				'phptype'  => 'sqlite3',
+				'phptype'  => $dbtype,
 				'database' => self::$dbpath,
 				'mode' => '0644'
 			);