tetsuo13 / MediaWiki-to-DokuWiki-Importer

Convert MediaWiki to DokuWiki
31 stars 10 forks source link

"PHP Fatal error: Cannot redeclare ..." #36

Closed qroques closed 8 years ago

qroques commented 8 years ago

Hi, I tried to run the script to convert my Mediawiki to Dokuwiki. Both directory are stored on the same physical server (Synology). src directory is on the web folder. I wrote the absolute path of both Mediawiki and Dokuwiki. Each time I launch the script (SSH) it returns the following error
Fatal error: Cannot redeclare hsc() (previously declared in /volume1/web/dokuwiki/inc/common.php:30) in /volume1/web/dokuwiki/inc/common.php on line 32

I have not seen anyone else having this issue with this script. So I guess I missed an important step but I cannot find where. Here's some informations about the installation PHP 5.6 Mediawiki 1.26.2 Dokuwiki 2016-06-26a "Elenor of Tsort" Server DSM 6.0.2 Maria DB 5.5

Thanks a lot

tetsuo13 commented 8 years ago

I think this may have been introduced by #33 which loads common.php but I can't be sure. DokuWiki has quite a few include files which load further include files and somewhere in there this file was loaded twice.

I've addressed this by ensuring each include file is loaded only once. Please try again using master.

qroques commented 8 years ago

Thank you for your quick reply. I still have error with this new version : PHP Fatal error: Call to undefined function token_get_all() in /volume1/web/MW2DW_2/src/MediaWiki2DokuWiki/MediaWiki/Settings.php on line 163

I tried with 9a120d0 commit from 5 aug and still PHP Fatal error: Call to undefined function token_get_all() in /volume1/web/MW2DW_2/src/MediaWiki2DokuWiki/MediaWiki/Settings.php on line 155)

The original bug is now is now closed I guess.

tetsuo13 commented 8 years ago

Strange. token_get_all() is a PHP function. Can you paste the output of php -v?

qroques commented 8 years ago

Thanks to this post I found out Synology servers have several php command line : "php" wich is an old version without tokenizer built-in "php56" with tokenizer I tried MW2DW converter with this one and it seems to work. By the way, the result of php -v

PHP 5.6.11 (cli) (built: Aug 17 2016 05:52:14) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

and php56 -v

PHP 5.6.21 (cli) (built: May 13 2016 19:44:10) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Thank you for your replies.

tetsuo13 commented 8 years ago

That's interesting. I suppose that the default PHP binary available was compiled without tokenizer support. The installation page notes the flags for it. I was originally thinking that perhaps the version of PHP you had was too old but turns out its a compilation flag issue. php -i | grep -i token shouldn't find anything while using php56 should.