Topic on Project:Support desk

Cargo query export to Excel or CSV gives error This page isn’t working

17
Pharmankur (talkcontribs)

Hi,

I am trying to install Mediawiki for our internal Documentation in organisation.

Product Version
MediaWiki 1.35.2
PHP 8.0.7 (apache2handler)
MariaDB 10.1.48-MariaDB-0ubuntu0.18.04.1
ICU 65.1
Lua 5.1.5

When I am setting a cargo query to output as table, it works fine. But when I set it to export results to CSV or Excel file then on clicking file download link, it shows a blank page saying --


This page isn’t working

XXX.XX.XXX.XX is currently unable to handle this request.

HTTP ERROR 500


I am sure our server is working fine, so there is no problem with it.

I also did NOT find any special settings instructions in Cargo to enable export in CSV or Excel. So I am clueless what is wrong or where to find out.

Please help !

Osnard (talkcontribs)

Hi! Are there any logs available? PHP error log for example? Please have a look at Manual:How_to_debug to learn about getting logs.

Jonathan3 (talkcontribs)

You'd definitely get an answer on the Cargo talk page.

Pharmankur (talkcontribs)

@Osnard

Hi, Php error reporting is already enabled by


<?php

error_reporting( -1 );

ini_set( 'display_errors', 1 );


@Jonathan3

Somehow I did not find any help available on setting up excel or csv export !

Osnard (talkcontribs)

An Error 500 must leave traces in the logs. Without them the error can not be fixed.

Jonathan3 (talkcontribs)

What's your Cargo query?

Pharmankur (talkcontribs)

Hi

@Osnard

With my default log setting LogLevel warn [ in /etc/apache2/apache2.conf ]

Only log entry there [ in /var/log/apache2/error.log ] is :-


[Sat Jun 19 13:24:29.712779 2021] [mpm_prefork:notice] [pid 21458] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations

[Sat Jun 19 13:24:29.712864 2021] [core:notice] [pid 21458] AH00094: Command line: '/usr/sbin/apache2'


If there is any other place to look for the logs, I am not aware.


@Jonathan3

My cargo query which works (shows a table on webpage) :-

{{#cargo_query: tables=Infobox |fields=Infobox._ID, Infobox._pageName, Infobox.Description, Infobox.01_Type_of_Document, Infobox.02_Doc_ID_No, Infobox.03_Supersede_by, Infobox.06_Effective_from_date, Infobox.07_Review_on_date, Infobox.04_For_Department, Infobox.09_Other_Info, Infobox.10_Prepared_by, Infobox.11_Checked_by, Infobox.12_Approved_by |format=table }}


But when I want the same table downloadable in excel, I am trying (and gives error in the discussion) :-

{{#cargo_query: tables=Infobox |fields=Infobox._ID, Infobox._pageName, Infobox.Description, Infobox.01_Type_of_Document, Infobox.02_Doc_ID_No, Infobox.03_Supersede_by, Infobox.06_Effective_from_date, Infobox.07_Review_on_date, Infobox.04_For_Department, Infobox.09_Other_Info, Infobox.10_Prepared_by, Infobox.11_Checked_by, Infobox.12_Approved_by |format=excel }}

Pharmankur (talkcontribs)
Jonathan3 (talkcontribs)

That's helpful. I get the same error:

This page isn’t working
www.... is currently unable to handle this request.
HTTP ERROR 500

format=csv works and can be loaded by Excel.

I wonder whether @Yaron Koren: could help here.

Osnard (talkcontribs)

Can you confirm you have installed "PhpSpreadsheet" as stated on the official docs?

  • If you plan to export data to an Excel spreadsheet, you need to install the PhpSpreadsheet library on your server. This can be done by adding phpoffice/phpspreadsheet to your composer.local.json and running composer update --no-dev -o.
Jonathan3 (talkcontribs)

I don't, and hadn't noticed that requirement when reproducing the error above - oops.

Pharmankur (talkcontribs)

Hi,

@Osnard and @Jonathan3

I have already tried that ... This is what composer.local.json looks like


{

"require": {

"mediawiki/mermaid": "~3.0",

"phpoffice/phpspreadsheet": "~1.18.0"

}

}


But I get error when running composer update --no-dev -o


myserver@myserver:/mnt/WIKIs/EisenDocs$ composer update --no-dev -o

Deprecation Notice: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php:62

Deprecation Notice: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php:108

Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:129

Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:129

In ArrayLoader.php line 44:

                                                                               

  Unknown package has no name defined ([{"name":"composer\/installers","versi  

  on":"v1.11.0","version_normalized":"1.11.0.0","source":{"type":"git","url":  

  "https:\/\/github.com\/composer\/installers.git","reference":"ae03311f45dfe  

  194412081526be2e003960df74b"},"dist":{"type":"zip","url":"https:\/\/api.git  

  hub.com\/repos\/composer\/installers\/zipball\/ae03311f45dfe194412081526be2  

  e003960df74b","reference":"ae03311f45dfe194412081526be2e003960df74b","shasu  

  m":""},"require":{"composer-plugin-api":"^1.0 || ^2.0"},"replace":{"roundcu  

  be\/plugin-installer":"*","shama\/baton":"*"},"require-dev":{"composer\/com  

  poser":"1.6.* || ^2.0","composer\/semver":"^1 || ^3","phpstan\/phpstan":"^0  

  .12.55","phpstan\/phpstan-phpunit":"^0.12.16","symfony\/phpunit-bridge":"^4  

  .2 || ^5","symfony\/process":"^2.3"},"time":"2021-04-28T06:42:17+00:00","ty  

  pe":"composer-plugin","extra":{"class":"Composer\\Installers\\Plugin","bran  

  ch-alias":{"dev-main":"1.x-dev"}},"installation-source":"dist","autoload":{  

  "psr-4":{"Composer\\Installers\\":"src\ .......................


Instead when I try php composer.phar update --no-dev

myserver@myserver:/mnt/WIKIs/EisenDocs$ php composer.phar update --no-dev

> ComposerHookHandler::onPreUpdate

Loading composer repositories with package information

Updating dependencies

Nothing to modify in lock file

Installing dependencies from lock file

Nothing to install, update or remove

Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.

Generating optimized autoload files

7 packages you are using are looking for funding.

Use the `composer fund` command to find out more!


It does something but still , finally excel does NOT get exported !


Note -- I am using PHP8.0 ... Does it have some role here ?

Jonathan3 (talkcontribs)

I don't understand composer but the compatibility page does say that MediaWiki isn't compatible with PHP 8.

Osnard (talkcontribs)

Maybe try switching to PHP 7.4.

Pharmankur (talkcontribs)

Hi @Osnard and @Jonathan3 : Many Thanks !

Observed that CSV export started working somehow ! ( I think reinstalling through Composer done the trick ) Now issue remains only with XLS export.


About PHP 7.4, According to Download

MediaWiki is not compatible with PHP 7.4.0 to 7.4.2 due to an upstream bug. Use PHP 7.4.3 or later instead. See task T246594 for more information.


Secondly we have already made many compatibility changes to extensions codes to make them suitable for PHP8.0 (Resolved many deprecation issues). So cannot fall back to earlier versions of PHP.

Conversely, is there any way to make phpoffice/phpspreadsheet compatible with PHP 8.0 ??

Osnard (talkcontribs)

Good news!

Yes, the incompatibility of MW is just three patchlevel versions (7.4.0, 7.4.1 and 7.4.2). If you do not happen to use one of those (which seems very unlikely) MW will run just fine. Regarding PHP 8 compatibilty of phpoffice/phpspreadsheet: Looks like V1.18 should be compatible: https://github.com/PHPOffice/PhpSpreadsheet/blob/1.18.0/composer.json

Pharmankur (talkcontribs)

@Osnard

Yeah I can see the documentation states that, but for me phpoffice/phpspreadsheet is not working.

Might be I am doing something incorrect, but no idea.

Reply to "Cargo query export to Excel or CSV gives error This page isn’t working"