server icon indicating copy to clipboard operation
server copied to clipboard

PHP7 Check for missing modules incomplete (should check for php-xml)

Open flurischt opened this issue 10 years ago • 17 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

Nextcloud seems to check if a required php module is missing. This does not seem to be the case for php-xml. If this module is missing only a 500 server error is reported when accessing the page.

  1. Install nextcloud on a machine using php7.0 and WITHOUT the php7.0-xml module installed
  2. Access the nextcloud login page

Expected behaviour

Nextcloud should tell me that the xml php module is missing as it does for other modules (like mbstring for example).

Actual behaviour

A 500 server error is thrown and then I need to check the log. The log tells me:

Exception: {\"Exception\":\"Error\",\"Message\":\"Call to undefined function OC\\\\AppFramework\\\\simplexml_load_file()\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/app.php(177): OC\\\\AppFramework\\\\App::buildAppNamespace('files')\\n#1 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/legacy\\\/app.php(115): OC_App::registerAutoloading('files', '\\\/var\\\/www\\\/nextcl...')\\n#2 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/base.php(658): OC_App::loadApps(Array)\\n#3 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/base.php(1059): OC::init()\\n#4 \\\/var\\\/www\\\/nextcloud\\\/index.php(46): require_once('\\\/var\\\/www\\\/nextcl...')\\n#5 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php\",\"Line\":60}

And then I have to figure out myself that this may be due to a missing php module.

Server configuration

Operating system: Ubuntu Xenial

Web server: Apache 2x

Database: MariaDB

PHP version: 7.0

Nextcloud version: 10.0.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated from owncloud -> nextcloud 9 -> nextcloud 10.0.1

flurischt avatar Nov 17 '16 14:11 flurischt

We actually check for this at https://github.com/nextcloud/server/blob/d7dd399bbda8da55f46db6e8f825bf282efbec52/lib/private/legacy/util.php#L731-L765. I suspect this code path is not reached because the simplexml_load_file is executed before.

LukasReschke avatar Nov 30 '16 15:11 LukasReschke

Yes, it looks like simplexml_load_file is called at /lib/private/App/InfoParser.php#61

At least I get this in my logs: {"reqId":"WEs3Ouaby31h2jIpj4c3fAAAAAA","remoteAddr":"127.0.0.1","app":"PHP","message":"Call to undefined function OC\App\simplexml_load_file() at /home/adi/public_html/nc/lib/private/App/InfoParser.php#61","level":3,"time":"2016-12-09T22:59:06+00:00","method":"GET","url":"/~adi/nc/index.php/apps/files/?dir=/&fileid=2","user":"--","version":"11.0.0.6"}

adsworth avatar Dec 09 '16 23:12 adsworth

here is the stack if that is of interest:

Array
(
    [0] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/private\/legacy\/app.php
            [line] => 706
            [function] => parse
            [class] => OC\\App\\InfoParser
            [object] => OC\\App\\InfoParser Object
                (
                    [cache:OC\\App\\InfoParser:private] => OC\\Memcache\nullCache Object
                        (
                            [prefix:protected] => 26e183a52d718a752f577b9fd14d4a8f\/core.appinfo
                        )
                )
            [type] => ->
            [args] => Array
                (
                    [0] => \/home\/adi\/public_html\/nc\/apps\/files\/appinfo\/info.xml
                )
        )
   [1] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/private\/AppFramework\/App.php
            [line] => 62
            [function] => getAppInfo
            [class] => OC_App
            [type] => ::
            [args] => Array
                (
                    [0] => files
                )
        )
    [2] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/private\/legacy\/app.php
            [line] => 196
            [function] => buildAppNamespace
            [class] => OC\\AppFramework\\App
            [type] => ::
            [args] => Array
                (
                    [0] => files
                )
        )
    [3] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/private\/legacy\/app.php
            [line] => 117
            [function] => registerAutoloading
            [class] => OC_App
            [type] => ::
            [args] => Array
                (
                    [0] => files
                    [1] => \/home\/adi\/public_html\/nc\/apps\/files
                )
        )
    [4] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/base.php
            [line] => 676
            [function] => loadApps
            [class] => OC_App
            [type] => ::
            [args] => Array
                (
                    [0] => Array
                        (
                            [0] => session
                        )
                )
        )
    [5] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/lib\/base.php
            [line] => 1092
            [function] => init
            [class] => OC
            [type] => ::
            [args] => Array
                (
                )
        )
    [6] => Array
        (
            [file] => \/home\/adi\/public_html\/nc\/index.php
            [line] => 38
            [args] => Array
                (
                    [0] => \/home\/adi\/public_html\/nc\/lib\/base.php
                )
            [function] => require_once
        )
)

adsworth avatar Dec 09 '16 23:12 adsworth

@nickvergessen Thanks for taking over this one

MorrisJobke avatar Dec 13 '16 00:12 MorrisJobke

Fix at https://github.com/nextcloud/server/pull/2619

nickvergessen avatar Dec 13 '16 13:12 nickvergessen

I've encountered this error in 13.0.4 again. Fresh install of php-7.2 and received 500 error.

Ran sudo -u www-data php occ upgrade to see if it maybe needed to finish an upgrade, and received:

Error: Call to undefined function OC\App\simplexml_load_file() in /var/www/nextcloud/lib/private/App/InfoParser.php:64 Stack trace: #0 /var/www/nextcloud/lib/private/legacy/app.php(621): OC\App\InfoParser->parse('/var/www/nextcl...') #1 /var/www/nextcloud/lib/private/AppFramework/App.php(62): OC_App::getAppInfo('files') #2 /var/www/nextcloud/lib/private/legacy/app.php(220): OC\AppFramework\App::buildAppNamespace('files') #3 /var/www/nextcloud/lib/private/legacy/app.php(119): OC_App::registerAutoloading('files', '/var/www/nextcl...') #4 /var/www/nextcloud/lib/base.php(662): OC_App::loadApps(Array) #5 /var/www/nextcloud/lib/base.php(1081): OC::init() #6 /var/www/nextcloud/console.php(46): require_once('/var/www/nextcl...') #7 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Manually installed php-xml via apt install php-xml and after an apache2 restart I received php module missing errors for php-mbstring php-zip and php-curl.

Before installing php-xml however, I did not see any of these notices and instead was just given a 500 error when navigating to the main page.

puppi3-music avatar Jun 29 '18 18:06 puppi3-music

The following helped me with the missing php modules: https://github.com/nextcloud/server/issues/15708#issuecomment-544471692

flostyen avatar Oct 21 '19 11:10 flostyen

Hi, please update to at least 23.0.12 and report back if it fixes the issue. Thank you!

szaimen avatar Nov 26 '22 14:11 szaimen

I upgraded from 24 to 25.0.3 via web interface

  • all upgrade steps passed
  • Nextcloud was not accessible, not giving any useful hint on the web interface.
  • trying to use the command line occ some missing php8 modules were reported
  • after installing these nextcloud was accessible.

suggestion

  • check and report missing modules as first step of the upgrade, which is going to be unsuccessful without installing the missing modules.
  • this will avoid a stress situation for the admin.

ferdiga avatar Jan 29 '23 16:01 ferdiga

BTW, the nextcloud admin may not have root privileges which are necessary to install the missing modules

ferdiga avatar Jan 31 '23 20:01 ferdiga

@ferdiga: Did you by chance also upgrade your PHP version at same time as upgrading NC? Because this module was already required for NC24 so you would have had it. The only scenario I can think of where you wouldn't have - possibly - is if you upgraded PHP also just prior to upgrading to NC25.

Whenever PHP gets upgraded on one's server, an admin has to check all the same PHP extensions are installed with the new version of PHP. Doing so is OS/distribution specific.

I understand the request to enhance the checks for dependencies within NC, but it's unclear how you ended up in this state during a straight NC upgrade for an extension that's been required going back to at least NC10.

Side note: The original fix proposed in PR #2619 was never merged. That may have been for good reason - I don't know as I haven't tested the patch myself.

joshtrichards avatar Jun 09 '23 14:06 joshtrichards

I am using Hetzner Storage share as a black box - hence I can (and should not) investigate what is running behind.

But I will try with my other installation on my server

ferdiga avatar Jun 10 '23 09:06 ferdiga

Nextcloud Hub 4 (26.0.2)

php -v PHP 8.1.14 (cli) (built: Jan 13 2023 10:38:02) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.14, Copyright (c) Zend Technologies with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies

no Error opening a 5MB dwg file , but nothing is displayed - just a white screen with icons of the app

ferdiga avatar Jun 10 '23 10:06 ferdiga

ah sorry NC uses php Version: 8.0.27

Memory limit: 512 MB

Max execution time: 3600

Upload max size: 2 MB

Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, Reflection, SPL, session, standard, sodium, apache2handler, mysqlnd, PDO, xml, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, intl, ldap, exif, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache

ferdiga avatar Jun 10 '23 10:06 ferdiga

I'd say this is a feature request to check the extensions before upgrading

szaimen avatar Jun 10 '23 11:06 szaimen

@ferdiga

I am using Hetzner Storage share as a black box - hence I can (and should not) investigate what is running behind.

There's your problem. They do it for you and tell you not to use the Nextcloud update process:

https://docs.hetzner.com/konsoleh/storage-share/faq/upgrade

joshtrichards avatar Jun 10 '23 16:06 joshtrichards

sorry this was a very old thread starting in 2016!! please forget all my postings .

ferdiga avatar Jun 10 '23 16:06 ferdiga