owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.38k stars 2.05k forks source link

Owncloud update from 9x to 10. fails ubuntu 14.04 #27762

Closed montanaviking closed 7 years ago

montanaviking commented 7 years ago
### Steps to reproduce 1. update php using: sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml \ php5.6-apcu php5.6-zip php5.6-gd php5.6-curl sudo a2dismod php5 sudo a2enmod php5.6 sudo service apache2 restart Tried mysql and phpmyadmin and working 2. run automated update (synaptic) to update Owncloud to latest version (10.0) 3. run owncloud update and got: ####################### /var/www/owncloud$ sudo -u www-data php occ upgrade [sudo] password for viking: An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/owncloud/lib/private/DB/Connection.php:63 Stack trace: #0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect() #1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion() #2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform() #3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform() #4 /var/www/owncloud/lib/private/DB/Connection.php(146): Doctrine\DBAL\Connection->setTransactionIsolation(2) #5 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager)) #6 /var/www/owncloud/lib/private/DB/ConnectionFactory.php(136): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager)) #7 /var/www/owncloud/lib/private/Server.php(461): OC\DB\ConnectionFactory->getConnection('mysql', Array) #8 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server)) #9 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('DatabaseConnect...') #10 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...') #11 /var/www/owncloud/lib/private/Server.php(1101): OC\ServerContainer->query('DatabaseConnect...') #12 /var/www/owncloud/lib/private/Server.php(226): OC\Server->getDatabaseConnection() #13 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server)) #14 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('UserManager') #15 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserManager') #16 /var/www/owncloud/lib/private/Server.php(953): OC\ServerContainer->query('UserManager') #17 /var/www/owncloud/lib/private/Server.php(267): OC\Server->getUserManager() #18 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server)) #19 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('UserSession') #20 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserSession') #21 /var/www/owncloud/lib/private/Server.php(970): OC\ServerContainer->query('UserSession') #22 /var/www/owncloud/lib/private/Server.php(507): OC\Server->getUserSession() #23 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server)) #24 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppManager') #25 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager') #26 /var/www/owncloud/lib/private/Server.php(1288): OC\ServerContainer->query('AppManager') #27 /var/www/owncloud/lib/private/legacy/app.php(310): OC\Server->getAppManager() #28 /var/www/owncloud/lib/private/legacy/app.php(106): OC_App::getEnabledApps() #29 /var/www/owncloud/lib/base.php(579): OC_App::loadApps(Array) #30 /var/www/owncloud/lib/base.php(994): OC::init() #31 /var/www/owncloud/console.php(57): require_once('/var/www/ownclo...') #32 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...') #33 {main}PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/owncloud/lib/private/DB/Connection.php:63 Stack trace: #0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect() #1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion() #2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform() #3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform() #4 /var/www/owncloud/lib/private/DB/Connection.php(146): Doctrine\DBAL\Connection->setTransactionIsolation(2) #5 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\D in ################################# ### Expected behaviour Tell us what should happen Owncloud should have updated normally ### Actual behaviour Tell us what happens instead Errors as shown above Owncloud server cannot start ### Server configuration **Operating system**: Ubuntu 14.04.5 Linux Sibyl 3.13.0-117-generic #164-Ubuntu SMP Fri Apr 7 11:05:26 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux **Web server:** Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04 **Database:** mysql Ver 14.14 Distrib 5.5.55, for debian-linux-gnu (x86_64) using readline 6.3 **PHP version:** php -v PHP 7.1.4-1+deb.sury.org~trusty+1 (cli) (built: Apr 11 2017 22:45:20) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.4-1+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies **ownCloud version:** (see ownCloud admin page) version 10.0 I think (latest) **Updated from an older ownCloud or fresh install:** Updated from 9.1x **Where did you install ownCloud from:** used ppa from Owncloud and synaptic package manager as had been done successfully for previous owncloud versions **Signing status (ownCloud 9.0 and above):** ``` Login as admin user into your ownCloud and access http://example.com/index.php/settings/integrity/failed paste the results into https://gist.github.com/ and puth the link here. ``` Cannot sign into my ownCloud server because it's broken all I see is: Update needed Please use the command line updater because you have a big instance. For help, see the documentation. **The content of config/config.php:** false, 'instanceid' => 'xxxxxxx', 'passwordsalt' => 'xxxxxxx', 'secret' => 'xxxxxxxxxxxx', 'trusted_domains' => array ( 0 => 'localhost', 1 => '192.168.1.10', 2 => 'xxr', 3 => 'xxl', 4 => 'xxx.xxx.xx.x49', 5 => 'xxr', 6 => 'xx', ), 'datadirectory' => '/carbonics/owncloud', 'overwrite.cli.url' => 'https://localhost/owncloud', 'dbtype' => 'mysql', 'version' => '9.1.5.2', 'dbname' => 'owncloud', 'dbhost' => 'localhost', 'dbtableprefix' => 'oc_', 'dbuser' => 'oc_xxxxx', 'dbpassword' => 'xxxxx', 'logtimezone' => 'UTC', 'installed' => true, 'memcache.local' => '\\OC\\Memcache\\APCu', 'maintenance' => false, 'ldapIgnoreNamingRules' => false, 'loglevel' => 3, 'session_lifetime' => 1728000, 'session_keepalive' => true, 'mail_from_address' => 'cloud', 'mail_smtpmode' => 'php', 'mail_domain' => 'xx.com', ); ``` Log in to the web-UI with an administrator account and click on 'admin' -> 'Generate Config Report' -> 'Download ownCloud config report' This report includes the config.php settings, the list of activated apps and other details in a well sanitized form. or If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your ownCloud installation folder *ATTENTION:* Do not post your config.php file in public as is. Please use one of the above methods whenever possible. Both, the generated reports from the web-ui and from occ config:list consistently remove sensitive data. You still may want to review the report before sending. If done manually then it is critical for your own privacy to dilligently remove *all* host names, passwords, usernames, salts and other credentials before posting. You should assume that attackers find such information and will use them against your systems. ``` **List of activated apps:** ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your ownCloud installation folder. ``` **Are you using external storage, if yes which one:** local/smb/sftp/... **Are you using encryption:** yes/no **Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/... #### LDAP configuration (delete this part if not used) ``` With access to your command line run e.g.: sudo -u www-data php occ ldap:show-config from within your ownCloud installation folder Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap'; Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ``` ### Client configuration **Browser:** **Operating system:** ### Logs #### Web server error log ``` Insert your webserver log here ``` #### ownCloud log (data/owncloud.log) ``` Insert your ownCloud log here ```nothing in this file #### Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
ghost commented 7 years ago

@montanaviking

Failed to connect to the database: An exception occured in driver: could not find driver

This shows that there is a misconfiguration in your PHP environment where the database driver is not correctly loaded. Please close here and ask for support on how to configure this correctly at the resources listed at https://secure.php.net/support.php

montanaviking commented 7 years ago

kdslkdsaldsal, thanks very much for looking at this. However, I would think that if PHP were misconfigured, then phpMyAdmin would also not function. However, phpMyAdmin functions with the same PHP configuration that the ownCloud 10 install failed on. Moreover, phpMyAdmin can access my MySQL database just fine. I don't want to change any configurations on PHP unless this is clearly the cause of my problem. Then again, just maybe said PHP configuration could selectively fail Owncloud 10? Any help in looking into this would be welcome because I'm a noob on PHP. Thanks, Phil

ghost commented 7 years ago

There are differences between your webserver (running phpmyadmin and owncloud via browser) and the php cli (which is called by occ). Your webserver module has loaded the correct db driver, your php cli on command line not.

If you need further support with this please contact the PHP support community as already advised.

montanaviking commented 7 years ago

Hi Again, My problem appears to be similar to that posted in: https://github.com/owncloud/core/issues/23130 and from this post I noticed: ######################### I had the same problem concerning what you've cited above: "exception 'Doctrine\DBAL\DBALException' with message 'Failed to connect to the database: An exception occured in driver: could not find driver' in /var/www/owncloud/lib/private/db/connection.php:54"

I solved it. The problem (in my case) was caused by different php version for 'the command line' and for the serving side via 'apache'. occ needs to use the same php version.

check the php version at the command line 'php -v' for example PHP7.0.2
check the php version which the serving-side is using via e.g. creating a info.php with the content: ""
this gives as output e.g. PHP 5.6.17

So the difference is PHP7.0.2 and PHP5.6.17. Btw the occ command is php based also.

I solved the problem by installing PHP5.6.17 at the 'command line' side as well so it is the same as at 'serving side'.

But we're not there yet in case you have multiple php versions on your system. If the 'php -v' doesn't give PHP5.6.17 you have to create a new alias for php (assuming the correct version is also stored in the file system, otherwise install it). Locate the correct php version with 'whereis php'. Change the alias to the correct path until the 'php -v' gives the same version as the 'serving side' php version. ############################################ Perhaps my phpMyAdmin installation uses a different version of php than OC or is indicating the wrong version? I think my root cause is similar to other recent posters' issues with Ubuntu 14.04 and OC 9x->10 upgrade. Apparently, this required upgrading PHP from 5.5.9 to 5.6.x and Ubuntu 14.04 uses PHP 5.5.9. So, it appears that I need to upgrade my PHP to at least 5.6.x but I have two questions namely:

  1. will ownCloud 10 work with PHP 7.x?
  2. Could someone kindly point me in the proper direction as how to properly migrate from PHP 5.5.9 to 5.6.x or 7.x? Last time, I tried using a ppa (see my original post) but that apparently gave problems. Apparently there's a command line invoked PHP and other PHP which is called by the http server. I'm thinking that my installation has these different? Any idea how to tell what PHP that Apache is using? Apparently it isn't the one I get via the command php -v. By the way, I retain copies of my old OS configuration, so I can recover from failed installations. Right now, I'm back to my original PHP and OC 9.x. Thanks so much, Phil
montanaviking commented 7 years ago

Sorry, I didn't see your latest post. I'm going to check my PHP installation and try to correct it. thanks, Phil

VicDeo commented 7 years ago

@montanaviking According to your report

sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-apcu php5.6-zip php5.6-gd php5.6-curl sudo a2dismod php5 sudo a2enmod php5.6 ... php -v PHP 7.1.4-1

  1. your webserver uses PHP5.6 (with php5.6-mysql ) - any database related code requested via web from the server (owncloud, phpmyadmin, etc) will work

  2. your CLI uses PHP 7 (most likely without php7.0-mysql) will not work to check this please run php -m from CLI and look for MySQL in the list of enabled modules

Install php5.6-cli package additionally

VicDeo commented 7 years ago

@montanaviking as I see from your last post you already solved that.

  1. will ownCloud 10 work with PHP 7.x?

yes.

  1. sudo a2dismod php5 sudo a2enmod php5.6

these lines mean Hey, apache webserver, stop using php5 module and Hey, apache webserver, start using php5.6 module

As you see PHP can be packed as Apache module. These packages are usually called libapache2-mod-phpX.Y CLI version of PHP is inside the package phpX.Y-cli

Packages like phpX.Y-something are modules of PHP itself. They are used both for Apache PHP module and PHP CLI given that they are compatible. 5.6 and 7.0 are not compatible from the point of modules. Which means that e.g. php5.6-mysql package is needed for 5.6 and php7.0-mysql is need for 7.0

IIRC It is possible to have 5.6 and 7.0 installed simultaneously and use it as follows sudo -u www-data php5.6 occ upgrade sudo -u www-data php7.0 occ upgrade php is just a symlink to either php5.6 or php7.0 in this case

montanaviking commented 7 years ago

Hi, In order to solve my owncloud 9.1.5 to 10.x upgrade problem, I would like to upgrade my php from 5.5.9 to php 7.0.15, Apache 2.4.7 to Apache 2.4.18, and MySQL 5.5.55 to MySQL 5.7.18. I'm currently running Ubuntu 14.04 and will eventually upgrade to Ubuntu 16.04, but before that, I'd like to put my PHP, Apache, and MySQL at the 16.04 versions (as above), run my present OC 9.1.5 now, and eventually upgrade OC from 9.1.5 to OC 10.0 or 10.1 (later). I like the idea of having 16.04's versions of the above working prior to migrating to 16.04.

My questions are:

  1. How do I upgrade Apache, PHP, and MySQL in a way that doesn't break my current OC 9.1.5? Are there settings in OC 9.1.5 configurations which need to be adjusted to the new Apache, PHP, and/or MySQL as above? I have looked at my owncloud/config/config.php file and didn't see anything regarding versions of the above (PHP, Apache, MySQL). Is the OC 9.1.5 agnostic regarding this or do I need to inform it as to my changes/upgrades?

  2. Also, if anyone here knows, should I do the above, can I migrate back to my former Apache, MySQL,PHP versions should other things break or will that break my OC database? Of course, I will back up my OC database. Thanks so much, Phil

montanaviking commented 7 years ago

I will probably not bother upgrading MySQL since OC 10.x will likely work with my present MySQL 5.5.55 and I'd like to let "sleeping dogs lie". Thanks

ghost commented 7 years ago

@montanaviking Please note this is a bugtracker for ownCloud where (as the name is saying) bugs for ownCloud are tracked / handled. Support questions like yours needs to go to:

  1. To https://central.owncloud.org/ if they are specific to ownCloud
  2. To https://secure.php.net/support.php if they are specific to PHP (like your initial report)
  3. To a support community dedicated to your used linux distro (In your case https://community.ubuntu.com/contribute/support). Especially your question 1 is completely unrelated to ownCloud and should be asked there.

@VicDeo Why keeping this open as this is clearly an environmental issue?

montanaviking commented 7 years ago

I have posted this question in https://central.owncloud.org/ and closed this thread.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.