Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
flurischt opened this issue Nov 17, 2016 · 17 comments · Fixed by #38857
Closed

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

flurischt opened this issue Nov 17, 2016 · 17 comments · Fixed by #38857

Comments

@flurischt
Copy link

flurischt commented Nov 17, 2016

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

@MorrisJobke MorrisJobke added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Nov 18, 2016
@MorrisJobke MorrisJobke self-assigned this Nov 18, 2016
@MorrisJobke MorrisJobke added this to the Nextcloud 11.0 milestone Nov 18, 2016
@LukasReschke
Copy link
Member

We actually check for this at

// Contains the dependencies that should be checked against
// classes = class_exists
// functions = function_exists
// defined = defined
// ini = ini_get
// If the dependency is not found the missing module name is shown to the EndUser
// When adding new checks always verify that they pass on Travis as well
// for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini
$dependencies = array(
'classes' => array(
'ZipArchive' => 'zip',
'DOMDocument' => 'dom',
'XMLWriter' => 'XMLWriter',
'XMLReader' => 'XMLReader',
),
'functions' => [
'xml_parser_create' => 'libxml',
'mb_strcut' => 'mb multibyte',
'ctype_digit' => 'ctype',
'json_encode' => 'JSON',
'gd_info' => 'GD',
'gzencode' => 'zlib',
'iconv' => 'iconv',
'simplexml_load_string' => 'SimpleXML',
'hash' => 'HASH Message Digest Framework',
'curl_init' => 'cURL',
'openssl_verify' => 'OpenSSL',
],
'defined' => array(
'PDO::ATTR_DRIVER_NAME' => 'PDO'
),
'ini' => [
'default_charset' => 'UTF-8',
],
);
. I suspect this code path is not reached because the simplexml_load_file is executed before.

@adsworth
Copy link

adsworth commented Dec 9, 2016

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
Copy link

adsworth commented Dec 9, 2016

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
        )
)

@MorrisJobke
Copy link
Member

@nickvergessen Thanks for taking over this one

@nickvergessen
Copy link
Member

Fix at #2619

@nickvergessen nickvergessen removed their assignment Feb 8, 2017
@MorrisJobke MorrisJobke removed the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label May 22, 2017
@MorrisJobke MorrisJobke removed this from the Nextcloud 12.0 milestone May 22, 2017
@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jun 20, 2018
@butterkitty
Copy link

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.

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Jun 29, 2018
@skjnldsv skjnldsv added the 1. to develop Accepted and waiting to be taken care of label Jun 6, 2019
@flostyen
Copy link

The following helped me with the missing php modules: #15708 (comment)

@szaimen
Copy link
Contributor

szaimen commented Nov 26, 2022

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

@szaimen szaimen added needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 1. to develop Accepted and waiting to be taken care of labels Nov 26, 2022
@ferdiga
Copy link

ferdiga commented Jan 29, 2023

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
Copy link

ferdiga commented Jan 31, 2023

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

@joshtrichards
Copy link
Member

@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.

@ferdiga
Copy link

ferdiga commented Jun 10, 2023

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
Copy link

ferdiga commented Jun 10, 2023

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
Copy link

ferdiga commented Jun 10, 2023

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

@szaimen
Copy link
Contributor

szaimen commented Jun 10, 2023

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

@joshtrichards
Copy link
Member

@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

@ferdiga
Copy link

ferdiga commented Jun 10, 2023

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

joshtrichards added a commit to joshtrichards/nc-server that referenced this issue Jun 16, 2023
Fixes nextcloud#2180
And prevents nextcloud#31473, nextcloud#23970, nextcloud#18610, nextcloud#15708

Avoids a 500 error and also gives a useful error message on the web interface if this module isn't installed, gets overlooked during a PHP upgrade, etc.

While we check for it later, it's too late for session.

Inspired by nextcloud#17163

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
joshtrichards added a commit to joshtrichards/nc-server that referenced this issue Jun 16, 2023
Fixes nextcloud#2180
And prevents nextcloud#31473, nextcloud#23970, nextcloud#18610, nextcloud#15708

Avoids a 500 error and also gives a useful error message on the web interface if this module isn't installed, gets overlooked during a PHP upgrade, etc.

While we check for it later, it's too late for session.

Inspired by nextcloud#17163

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 2. developing Work in progress feature: install and update and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 14, 2023
AndyScherzinger pushed a commit to joshtrichards/nc-server that referenced this issue Feb 27, 2024
Fixes nextcloud#2180
And prevents nextcloud#31473, nextcloud#23970, nextcloud#18610, nextcloud#15708

Avoids a 500 error and also gives a useful error message on the web interface if this module isn't installed, gets overlooked during a PHP upgrade, etc.

While we check for it later, it's too late for session.

Inspired by nextcloud#17163

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.