wallabag / wallabag

wallabag is a self hostable application for saving web pages: Save and classify articles. Read them later. Freely.
https://wallabag.org
MIT License
10.2k stars 761 forks source link

[error] v2 nginx hosting error #1828

Closed Rurik19 closed 8 years ago

Rurik19 commented 8 years ago

Issue details

cannot run app under nginx. Got an error 500 ` 2016/04/01 10:21:44 [error] 2269#0: *24659 FastCGI sent in stderr: "PHP message: PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "/var/www/wallabag2/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping/User.orm.xml" in /var/www/wallabag2/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 814 PHP message: PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "/var/www/wallabag2/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping/User.orm.xml" in /var/www/wallabag2/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 814 PHP message: PHP Fatal error: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'Invalid mapping file 'FOS.UserBundle.Model.User.orm.xml' for class 'FOS\UserBundle\Model\User'.' in /var/www/wallabag2/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:86 Stack trace:

0 /var/www/wallabag2/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php(117): Doctrine\Common\Persistence\Mapping\MappingException::invalidMappingFile('FOS\UserBundle...', 'FOS.UserBundle....')

1 /var/www/wallabag2/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php(58): Doctrine\Common\Persistence\Mapping\Driver\FileDriver->getElement('FOS\UserBundle...')

2 /var/www/wallabag2/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php(102): Doctrine\ORM\Mapping\Driver\XmlDriver->loadMetadataForClass('FOS\UserBundle...', Object(Doctrine\ORM\Mapping\ClassMetadata))

3 /var/www/wallab" while reading response header from upstream, client: 78.47.230.141, server: wallabag2.wst174.ru, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "wallabag2.wst174.ru"

`

Environment

-host v2 in /var/www/wallabag2

tcitworld commented 8 years ago

wow

If you do a Google search on "failed to load external entity symfony" or "failed to load external FosUserBundle" you will find quite a few people having issues due to Doctrine mapping failed to load xml mapping (mostly of FosUserBundle). Most people describe the problem as randomly happening, unexplained and resolved by restarting PHP (which will reset libxml_disable_entity_loader back to false).

https://github.com/doctrine/doctrine2/issues/3788 and https://github.com/FriendsOfSymfony/FOSUserBundle/issues/1062

Rurik19 commented 8 years ago

Thanks for links!

Restarting php does'n help, it seems that this hack in XmlDriver.php $xmlData = file_get_contents($file); $xmlElement = simplexml_load_string($xmlData); resolves this (exactly) issue, but after redirect to /login I have another

[2016-04-01 13:23:17] request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Setting "piwik_enabled" couldn't be found.") in "WallabagCoreBundle::base.html.twig" at line 77." at /var/www/wallabag2/var/cache/prod/classes.php line 1245 {"exception":"[object](Twig_Error_Runtime%28code: 0%29: An exception has been thrown during the rendering of a template %28"Setting "piwik_enabled" couldn't be found."%29 in "WallabagCoreBundle::base.html.twig" at line 77. at /var/www/wallabag2/var/cache/prod/classes.php:1245, RuntimeException%28code: 0%29: Setting "piwik_enabled" couldn't be found. at /var/www/wallabag2/vendor/craue/config-bundle/Util/Config.php:139)"} []

tcitworld commented 8 years ago

Seems the settings file hasn't been created properly. You should try again composer up and php bin/console wallabag:install.

Rurik19 commented 8 years ago

Seems the settings file hasn't been created properly. You should try again composer up and php bin/console wallabag:install.

All things reinstalls ok. But error is the same.

Rurik19 commented 8 years ago

And also: Running PHP built-in server have the same error

Rurik19 commented 8 years ago

v2.0.0 final has the same error about piwik_enabled setting

j0k3r commented 8 years ago

Can you try again with a fresh install?

Rurik19 commented 8 years ago

git v a119acd - all the same

there was warnings in composer install - is it important? Skipped installation of bin security-checker for package sensiolabs/security-checker: name conflicts with an existing file Skipped installation of bin bin/doctrine-dbal for package doctrine/dbal: name conflicts with an existing file Skipped installation of bin bin/doctrine for package doctrine/orm: name conflicts with an existing file Skipped installation of bin bin/doctrine.php for package doctrine/orm: name conflicts with an existing file Skipped installation of bin bin/doctrine-migrations for package doctrine/migrations: name conflicts with an existing file

j0k3r commented 8 years ago

Could you describe a step by step to reproduce the error with piwik?

Rurik19 commented 8 years ago

just all standard steps

git clone https://github.com/wallabag/wallabag.git
cd wallabag
git checkout 2.0.0
SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
php bin/console wallabag:install --env=prod
php bin/console server:run --env=prod

as db backend I use mysql, the database is allready created, so in wallabag:install step I refuse creating schema and admin user

and then http://localhost:8000/login got 500 error, no error record in nginx log, just error in var/logs/prod.log

Rurik19 commented 8 years ago

maibe composer does't install some packages for ARM architecture?

Rurik19 commented 8 years ago

wow! it seems that is database issue = standard answers about sqlite -> works! (with hack in XmlDriver.php)

tcitworld commented 8 years ago

database is allready created, so in wallabag:install step I refuse creating schema and admin user

You should recreate schema anyway.

Rurik19 commented 8 years ago

Step 2 of 4. Setting up database. It appears that your database already exists. Would you like to reset it? (y/N)y Droping database, creating database and schema The command "doctrine:database:drop" terminated with an error code: 1.

Rurik19 commented 8 years ago

catch it! for non-SQLite databases parameter database_path must be empty!

Rurik19 commented 8 years ago

Summary

dedioste commented 7 years ago

Same problem for me on an identical setup; resolved with the same steps (patch to XmlDriver.php and clan database_path)

governorgoat commented 7 years ago

Same issue as well, fixed with patching and empty database_path string.