Page MenuHomePhabricator

PHP Fatal error: include(): Cannot redeclare class psr\log\loggerinterface in /vendor/composer/ClassLoader.php:412
Closed, InvalidPublic

Description

After update from 1.24 series to 1.25, I started having this error on certain pages. Currently the error shows up when I click Upload at the File Upload page (which is Dosya Yükle in Turkish translation), among others.

I did follow documentation on the release notes; MediaWiki was first installed from tarball, then I tried the git-compose install/update method. The psr directory exists in $IP/vendor.

MediaWiki requires the PSR-3 logging library to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user. Please see mediawiki.org for help on installing the required components.MediaWiki requires the PSR-3 logging library to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user. Please see mediawiki.org for help on installing the required components.

I can reproduce the error. Mediawiki error report:

( ! ) Fatal error: include(): Cannot redeclare class psr\log\loggerinterface in
/srv/www/mywiki.mydomain.com/vendor/composer/ClassLoader.php on line 412
Call Stack
# Time Memory Function Location
1 0.0001 241112 {main}( ) ../index.php:0
2 2.9770 2424544 MediaWiki->run( ) ../index.php:41
3 2.9770 2425104 MediaWiki->main( ) ../MediaWiki.php:414
4 3.0107 3203232 MediaWiki->performRequest( ) ../MediaWiki.php:566
5 3.0343 3415968 SpecialPageFactory::executePath( ) ../MediaWiki.php:267
6 3.0433 3966400 SpecialPage->run( ) ../SpecialPageFactory.php:582
7 3.0434 3966496 SpecialUpload->execute( ) ../SpecialPage.php:384
8 3.1018 5433712 SpecialUpload->processUpload( ) ../SpecialUpload.php:195
9 4.3216 7132504 SpecialUpload->showUploadWarning( ) ../SpecialUpload.php:458
10 4.3406 7381440 SpecialUpload->getDupeWarning( ) ../SpecialUpload.php:368
11 4.3538 7501392 TraditionalImageGallery->toHTML( ) ../SpecialUpload.php:748
12 4.3599 7838880 Linker::processResponsiveImages( ) ../TraditionalImageGallery.php:136
13 4.3625 7842584 File->transform( ) ../Linker.php:895
14 4.3644 7858520 File->generateAndSaveThumb( ) ../File.php:1079
15 4.3647 7860640 TransformationalImageHandler->doTransform( ) ../File.php:1112
16 4.3658 7866960 BitmapHandler->transformImageMagick( ) ../TransformationalImageHandler.php:244
17 4.3658 7868760 TransformationalImageHandler->getMagickVersion( ) ../Bitmap.php:91
18 4.3659 7869648 wfDebug( ) ../TransformationalImageHandler.php:517
19 4.3659 7870024 MediaWiki\Logger\LoggerFactory::getInstance( ) ../GlobalFunctions.php:1055
20 4.3659 7870120 interface_exists ( ) ../LoggerFactory.php:97
21 4.3659 7870440 Composer\Autoload\ClassLoader->loadClass( ) ../LoggerFactory.php:0
22 4.3659 7870440 Composer\Autoload\includeFile( ) ../ClassLoader.php:301
MediaWiki requires the PSR-3 logging library to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user. Please see mediawiki.org for help on installing the required components.MediaWiki requires the PSR-3 logging library to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user. Please see mediawiki.org for help on installing the required components.
( ! ) Fatal error: MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging library</a> to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user. Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a> for help on installing the required components. in /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php on line 107
Call Stack
# Time Memory Function Location
1 0.0001 241112 {main}( ) ../index.php:0
2 2.9770 2424544 MediaWiki->run( ) ../index.php:41
3 2.9770 2425104 MediaWiki->main( ) ../MediaWiki.php:414
4 3.0107 3203232 MediaWiki->performRequest( ) ../MediaWiki.php:566
5 3.0343 3415968 SpecialPageFactory::executePath( ) ../MediaWiki.php:267
6 3.0433 3966400 SpecialPage->run( ) ../SpecialPageFactory.php:582
7 3.0434 3966496 SpecialUpload->execute( ) ../SpecialPage.php:384
8 3.1018 5433712 SpecialUpload->processUpload( ) ../SpecialUpload.php:195
9 4.3216 7132504 SpecialUpload->showUploadWarning( ) ../SpecialUpload.php:458
10 4.3406 7381440 SpecialUpload->getDupeWarning( ) ../SpecialUpload.php:368
11 4.3538 7501392 TraditionalImageGallery->toHTML( ) ../SpecialUpload.php:748
12 4.3599 7838880 Linker::processResponsiveImages( ) ../TraditionalImageGallery.php:136
13 4.3625 7842584 File->transform( ) ../Linker.php:895
14 4.3644 7858520 File->generateAndSaveThumb( ) ../File.php:1079
15 4.3647 7860640 TransformationalImageHandler->doTransform( ) ../File.php:1112
16 4.3658 7866960 BitmapHandler->transformImageMagick( ) ../TransformationalImageHandler.php:244
17 4.3658 7868760 TransformationalImageHandler->getMagickVersion( ) ../Bitmap.php:91
18 4.3659 7869648 wfDebug( ) ../TransformationalImageHandler.php:517
19 4.3659 7870024 MediaWiki\Logger\LoggerFactory::getInstance( ) ../GlobalFunctions.php:1055
20 4.3659 7870120 interface_exists ( ) ../LoggerFactory.php:97
21 4.3659 7870440 Composer\Autoload\ClassLoader->loadClass( ) ../LoggerFactory.php:0
22 4.3659 7870440 Composer\Autoload\includeFile( ) ../ClassLoader.php:301
23 4.3676 7880328 MWExceptionHandler::handleFatalError( ) ../MWExceptionHandler.php:0
24 4.3676 7866992 MWExceptionHandler::logError( ) ../MWExceptionHandler.php:265
25 4.3678 7869072 wfDebugLog( ) ../MWExceptionHandler.php:507
26 4.3678 7869608 MediaWiki\Logger\LoggerFactory::getInstance( ) ../GlobalFunctions.php:1155
27 4.3678 7870160 trigger_error ( ) ../LoggerFactory.php:107
28 4.3678 7871592 MWExceptionHandler::handleError( ) ../LoggerFactory.php:107
29 4.3679 7883192 MWExceptionHandler::logError( ) ../MWExceptionHandler.php:222
30 4.3680 7886192 wfDebugLog( ) ../MWExceptionHandler.php:507
31 4.3680 7887656 MediaWiki\Logger\LoggerFactory::getInstance( ) ../GlobalFunctions.php:1155
32 4.3680 7888208 trigger_error ( ) ../LoggerFactory.php:107

And Apache error when I try/refresh the relevant page(s):

[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP Fatal error: include(): Cannot redeclare class
psr\\log\\loggerinterface in /srv/www/mywiki.mydomain.com/vendor/composer/ClassLoader.php on line 412, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP Stack trace:, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 1. {main}() /srv/www/mywiki.mydomain.com/index.php:0, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 2. MediaWiki->run() /srv/www/mywiki.mydomain.com/index.php:41, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 3. MediaWiki->main() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:414, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 4. MediaWiki->performRequest() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:566, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 5. SpecialPageFactory::executePath() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:267, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 6. SpecialPage->run() /srv/www/mywiki.mydomain.com/includes/specialpage/SpecialPageFactory.php:582, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 7. SpecialVersion->execute() /srv/www/mywiki.mydomain.com/includes/specialpage/SpecialPage.php:384, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 8. SpecialVersion->getExtensionCredits() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:129, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 9. SpecialVersion->getExtensionCategory() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:463, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 10. SpecialVersion->getCreditsForExtension() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:637, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 11. GitInfo->getHeadCommitDate() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:743, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 12. wfShellExec() /srv/www/mywiki.mydomain.com/includes/GitInfo.php:218, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 13. wfDebug() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:2802, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 14. MediaWiki\\Logger\\LoggerFactory::getInstance() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:1055, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 15. interface_exists() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:97, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 16. Composer\\Autoload\\ClassLoader->loadClass() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:0, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 17. Composer\\Autoload\\includeFile() /srv/www/mywiki.mydomain.com/vendor/composer/ClassLoader.php:301, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP Fatal error: MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging library</a> to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user.\n\nPlease see <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a> for help on installing the required components. in /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php on line 107, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP Stack trace:, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 1. {main}() /srv/www/mywiki.mydomain.com/index.php:0, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 2. MediaWiki->run() /srv/www/mywiki.mydomain.com/index.php:41, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 3. MediaWiki->main() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:414, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 4. MediaWiki->performRequest() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:566, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 5. SpecialPageFactory::executePath() /srv/www/mywiki.mydomain.com/includes/MediaWiki.php:267, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 6. SpecialPage->run() /srv/www/mywiki.mydomain.com/includes/specialpage/SpecialPageFactory.php:582, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 7. SpecialVersion->execute() /srv/www/mywiki.mydomain.com/includes/specialpage/SpecialPage.php:384, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 8. SpecialVersion->getExtensionCredits() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:129, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 9. SpecialVersion->getExtensionCategory() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:463, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 10. SpecialVersion->getCreditsForExtension() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:637, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 11. GitInfo->getHeadCommitDate() /srv/www/mywiki.mydomain.com/includes/specials/SpecialVersion.php:743, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 12. wfShellExec() /srv/www/mywiki.mydomain.com/includes/GitInfo.php:218, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 13. wfDebug() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:2802, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 14. MediaWiki\\Logger\\LoggerFactory::getInstance() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:1055, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 15. interface_exists() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:97, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 16. Composer\\Autoload\\ClassLoader->loadClass() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:0, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 17. Composer\\Autoload\\includeFile() /srv/www/mywiki.mydomain.com/vendor/composer/ClassLoader.php:301, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 18. MWExceptionHandler::handleFatalError() /srv/www/mywiki.mydomain.com/includes/exception/MWExceptionHandler.php:0, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 19. MWExceptionHandler::logError() /srv/www/mywiki.mydomain.com/includes/exception/MWExceptionHandler.php:265, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 20. wfDebugLog() /srv/www/mywiki.mydomain.com/includes/exception/MWExceptionHandler.php:507, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 21. MediaWiki\\Logger\\LoggerFactory::getInstance() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:1155, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 22. trigger_error() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:107, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 23. MWExceptionHandler::handleError() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:107, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 24. MWExceptionHandler::logError() /srv/www/mywiki.mydomain.com/includes/exception/MWExceptionHandler.php:222, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 25. wfDebugLog() /srv/www/mywiki.mydomain.com/includes/exception/MWExceptionHandler.php:507, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 26. MediaWiki\\Logger\\LoggerFactory::getInstance() /srv/www/mywiki.mydomain.com/includes/GlobalFunctions.php:1155, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar
[Thu May 28 06:55:06 2015] [error] [client 192.168.1.1] PHP 27. trigger_error() /srv/www/mywiki.mydomain.com/includes/debug/logger/LoggerFactory.php:107, referer: http://mywiki.mydomain.com/index.php/%C3%96zel:%C3%96zelSayfalar

Event Timeline

emirhan raised the priority of this task from to Needs Triage.
emirhan updated the task description. (Show Details)
emirhan subscribed.
lcawte renamed this task from PSR-3 logging library not present error with MediaWiki-1.5.1 tarball to PSR-3 logging library not present error with MediaWiki-1.25.1 tarball.Jun 9 2015, 8:53 AM
lcawte triaged this task as Medium priority.
lcawte added a project: MW-1.25-release.
lcawte set Security to None.
Aklapper raised the priority of this task from Medium to Needs Triage.Jun 9 2015, 8:55 AM
Aklapper edited projects, added Composer; removed MW-1.25-release.

(Sorry lcawte; mid-air collision when editing)

Update.

I think I narrowed it down to the images directory. When I move the images directory (which holds images as well as PDFs, PPTs) from the installation directory, the issue seems to be solved. When I move the directory back, the error starts again.

I also tried the maintenance/importImages.php script for importing the images from the old installation directory (instead of simply copying). No luck.

Krinkle renamed this task from PSR-3 logging library not present error with MediaWiki-1.25.1 tarball to PHP Fatal error: include(): Cannot redeclare class psr\log\loggerinterface in /vendor/composer/ClassLoader.php:412.Jun 28 2015, 12:48 AM
Krinkle triaged this task as High priority.
Krinkle added a project: MediaWiki-Installer.

The error you reported does not mean PSR-3 is not installed. In fact, it means the opposite. The error shows that the vendor/ directory exists and contains the PSR-3 class.

However when it loads it, it claims it is a redeclaration. In other words, it has been defined by something else. And then when MediaWiki tries to load its own, it ends up loading a second time. Loading the same class twice is not possible and as such the engine aborts with a fatal error.

Perhaps you have an older extension installed that also ships a PSR-3 interface?

Perhaps you have an older extension installed that also ships a PSR-3 interface?

@emirhan: Can you answer this? Is this still an issue?

Aklapper changed the task status from Open to Stalled.Jul 23 2016, 3:06 PM
Aklapper lowered the priority of this task from High to Low.
Aklapper removed a project: MW-1.25-release.

Perhaps you have an older extension installed that also ships a PSR-3 interface?

@emirhan: Can you answer this? Is this still an issue?

Ciencia_Al_Poder subscribed.

Declining... Nobody cared to reply and MW1.25 is no longer supported