Reviewed & tested by the community
Project:
Facebook Instant Articles
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2016 at 12:50 UTC
Updated:
26 Jun 2020 at 12:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
exlin commentedThis patch below solved the issue at least for me.
Comment #3
exlin commentedSorry, update the copy-paste mistake ;)
Comment #4
scottrigby@exlin hi, thanks for contributing. I believe the WSOD was fixed in #2704791: Check autoload in hook_requirements. We will be creating a rc2 release with that fix soon.
What is your Composer dependency workflow like BTW (are you using composer_manager)?
Either way, I don't think we want to include this dependency in the module
composer.jsonfile because theapache/log4phpdependency is already declared in the SDK composer.json file: https://github.com/facebook/facebook-instant-articles-sdk-php/blob/maste...Also for future ref note from the project page and README, that rather than patches:
. We just updated the project page yesterday, so no worries if you missed that :)
Comment #5
scottrigby@exlin one problem I just saw someone run into is that Composer downloads the
apache/log4phppackage as a git clone. The problem is that this works fine in the environment where you build it (usually your local) but if you commit your code to another project-specific git repo, this is picked up as a submodule, so those files are never on the environment where you deploy. If this is your scenario, you can un-submodule it, then commit the actual files.Let me know if any of that applies to your problem (and if so, whether adding that to the README would help others in that situation)? Or if not, can you clarify your composer workflow? Also note you will want to try this on this module's
7.x-1.xbranch as it fixed #2704791: Check autoload in hook_requirements.Comment #6
scottrigbyI'm marking this as a duplicate of #2704791: Check autoload in hook_requirements.
We've just posted a new release with this fix in it: #2705821: Create FB Instant Articles 7.x-1.0-rc2
Comment #7
exlin commentedThanks,
Just to answer previous questions i were using Composer Manager. This would have been first composer requirement of this specific project, usually we have deployed the changes to different environments and built the site from make using custom build script which after everything is done points symlink to different location and runs database update.
Comment #8
sillygwailoComment #9
daveianoJust installed the 7.x-1.0-rc2 Version for the first time. Fatal Error with wsod is still appearing. I'am working with Composer Manager.
PHP Fatal error: Class 'Logger' not found in /xxx/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module on line 171
EDIT: This Error only occurs if you enable the module via the module list, if you enable the module via drush, apache/log4php is correctly installed via composer.
Comment #10
capellicI too am having this problem. I followed @daveiano's suggestion and installed via drush and it worked.
1. drush en composer_manager
2. drush en fb_instant_articles fb_instant_articles_views fb_instant_articles_display
FYI, the release notes for rc2 don't include this issue (https://www.drupal.org/project/fb_instant_articles/releases/7.x-1.0-rc2).
Comment #11
scottrigby@capellic++
You know what, I thought we make this clear on the project page & README, that we *strongly* recommend enabling composer_manager first to manage dependencies and autoloading, and the only people who shouldn't do that already have sophisticated frameworks for handling all of this. Everyone else should follow the recommendation (but it's for those few who already have a system in place that we don't *depend* on composer_manager).
Comment #12
kellyimagined commented@scottrigby I have tried the directions in #10 and no luck. I am able to install the root module, but all submodules fail. I am trying with 7.x-1.0-rc2
Comment #13
capellicJust realizing that I am using the 2.x-dev version, not 1.0-RC2 like I stated in comment #10.
Comment #14
kellyimagined commented@capellic are you able to get things enabled and running on RC2? If so, what process did you take?
Comment #15
capellicYes, I followed the same steps I followed in comment #10 after refreshing the DB. If you don't refresh the DB you'll get an error when installing indicating that a table already exists - I can't remember what that was called. Or if you can't refresh your DB, simply delete that table.
Comment #16
kellyimagined commented@capellic,
Any suggestions on this, which now provides a fatal error:
drush dl fb_instant_articles
Project fb_instant_articles (7.x-2.x-dev) downloaded to sites/all/modules/contrib/fb_instant_articles. [success]
Project fb_instant_articles contains 6 modules: fb_instant_articles_api, fb_instant_articles_views, fb_instant_articles_api_rules, fb_instant_articles_display, fb_instant_articles_rss, fb_instant_articles.
drush en fb_instant_articles fb_instant_articles_views fb_instant_articles_display
The following extensions will be enabled: fb_instant_articles, fb_instant_articles_views, fb_instant_articles_display
Do you really want to continue? (y/n): y
fb_instant_articles was enabled successfully. [ok]
fb_instant_articles defines the following permissions: administer fb_instant_articles
fb_instant_articles_display was enabled successfully. [ok]
fb_instant_articles_display defines the following permissions: administer fb_instant_articles_display
fb_instant_articles_views was enabled successfully. [ok]
drush composer-json-rebuild
include(/drupal/sites/all/vendor/apache/log4php/src/main/php/Logger.php): [warning]
failed to open stream: No such file or directory ClassLoader.php:412
include(): Failed opening [warning]
'/drupal/sites/all/vendor/apache/log4php/src/main/php/Logger.php' for
inclusion (include_path='.:/opt/remi/php55/root/usr/share/pear:/opt/remi/php55/root/usr/share/php:/usr/share/pear:/usr/share/php')
ClassLoader.php:412
PHP Fatal error: Class 'Logger' not found in /drupal/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module on line 184
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class 'Logger' not found in
/drupal/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module,
line 184
drush rr
The registry has been rebuilt via registry_rebuild (A). [success]
All caches have been cleared with drush_registry_rebuild_cc_all. [success]
The registry has been rebuilt via drush_registry_rebuild_cc_all (B). [success]
All caches have been cleared with drush_registry_rebuild_cc_all. [success]
All registry rebuilds have been completed. [success]
drush updatedb
No database updates required [success]
include(/drupal/sites/all/vendor/apache/log4php/src/main/php/Logger.php): [warning]
failed to open stream: No such file or directory ClassLoader.php:412
include(): Failed opening [warning]
'/drupal/sites/all/vendor/apache/log4php/src/main/php/Logger.php' for
inclusion (include_path='.:/opt/remi/php55/root/usr/share/pear:/opt/remi/php55/root/usr/share/php:/usr/share/pear:/usr/share/php')
ClassLoader.php:412
PHP Fatal error: Class 'Logger' not found in /drupal/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module on line 184
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class 'Logger' not found in
/drupal/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module,
line 184
The external command could not be executed due to an application error. [error]
Finished performing updates. [ok]
Comment #17
kdechant commented@kellyimagined: I think the Logger class comes from a Composer package. If composer_manager is not fully set up before fb_instant_articles is enabled, you'll see the "PHP Fatal error: Class 'Logger' not found" error.
This happened to me when I used an update hook to install composer_manager. On closer inspection, I found that composer_manager's install process shows an additional prompt to the user. Apparently, module_enable() doesn't trigger this question (or doesn't know how to answer it) so composer_manager doesn't get fully installed. fb_instant_articles then can't install its packages, and you see the above error.
TL;DR: Composer Manager doesn't seem to get installed correctly with module_enable(). Anyone encountering this problem may need to use Drush instead.
Comment #18
scottrigby@kdechant is right you should use Drush to get the dependencies and automatically write the autoload files.
However, once the php dependencies are downloaded and autoload files created with Drush in your local dev environment, you can commit those files to your project repo and push those up to production. Once you have these files in place, you can enable the module with module_enable() with no problem (i.e, you do not need to - and shoud not - enable composer_manager in production). This is general info relevant to the composer_manager project, and not to fb_instant_articles.
Comment #19
estratos2 commentedthis fixed in my case the issue
adding
include('log4php/Logger.php');
on fb_instant_articles.module
/**
* Implements hook_init().
*
* @todo Update to use a custom DrupalFBInstantArticlesLogger once
* @link https://github.com/facebook/facebook-instant-articles-sdk-php/issues/14 this SDK issue @endlink is in resolved.
*/
function fb_instant_articles_init() {
++ include('log4php/Logger.php');
$enable_transformer_logging = variable_get('fb_instant_articles_enable_logging');
I managed to install sdk dependency via composer on module directory, composer install
And installed Log4Php globally using pear
pear channel-discover pear.apache.org/log4php
pear install log4php/Apache_log4php
make sure you php.ini has the correct path to Logger
Comment #20
antoniomanco commentedI have several problems and this error.
Fatal error: Class 'Drupal\fb_instant_article\ArticleWrapper' not found in /home/misitio/public_html/sites/all/modules/module-fb_instant_articles-7.x-2.x/modules/fb_instant_articles_display/fb_instant_articles_display.module on line 36
I try all options in this tutorial but no found.
I agree this error in drush:
misite@misite.pe [~/www/sites/all]# drush en fb_instant_articles_display
The following extensions will be enabled: fb_instant_articles_display
Do you really want to continue? (y/n): y
exception 'DatabaseSchemaObjectExistsException' with message 'Table [error]
fb_instant_articles_display_entity_types already exists.' in
/home/misite/public_html/includes/database/schema.inc:660
Stack trace:
#0 /home/misite/public_html/includes/database/database.inc(2776):
DatabaseSchema->createTable('fb_instant_arti...', Array)
#1 /home/misite/public_html/includes/common.inc(7107):
db_create_table('fb_instant_arti...', Array)
#2 /home/misite/public_html/includes/module.inc(479):
drupal_install_schema('fb_instant_arti...')
#3
phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc(143):
module_enable(Array)
#4 phar:///usr/local/bin/drush/commands/pm/pm.drush.inc(1167):
drush_module_enable(Array)
#5 [internal function]: drush_pm_enable('fb_instant_arti...')
#6 phar:///usr/local/bin/drush/includes/command.inc(366):
call_user_func_array('drush_pm_enable', Array)
#7 phar:///usr/local/bin/drush/includes/command.inc(217):
_drush_invoke_hooks(Array, Array)
#8 [internal function]: drush_command('fb_instant_arti...')
#9 phar:///usr/local/bin/drush/includes/command.inc(185):
call_user_func_array('drush_command', Array)
#10 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#11 phar:///usr/local/bin/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 phar:///usr/local/bin/drush/includes/startup.inc(289):
drush_main()
#13 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#14 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#15 {main}
misite@misite.pe [~/www/sites/all]#
Comment #21
scottrigbyComment #22
AndyThornton commentedmy colleague and i just spent the whole day just bashing our stupid heads against this wall ... in a fashion that is really beyond the pale. i post this hoping that maybe it gives some other unfortunate individual some respite. i am sure this is me being a composer dumbass, so this is posted without any judgement (or assumption that this is right).
we use pantheon, and the issue we had was that the automatically generated autoload_psr4.php file (found in your vendor/composer directory) assumes that Drupal files are always located in sites/default/files.
so, with pantheon, they have a [home]/code and a [home]/files directory. we had something that looked like this
but that path does not resolve (fine on my local, but not on pantheon)
after said headbashing, i found this worked
as this is auto-generated my next job is to figure out whether we have any control over the inputs into this ... but I thought maybe just knowing to look at that file might save someone a little time.
Comment #23
crisp330 commentedI am getting the same error - Fatal error: Class 'Logger' not found in [...path to my site...]/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module on line 184.
I have composer already installed along with Composer Manager, and have installed the Facebook Instant Articles SDK via composer. I get a fatal error which breaks the entire site. Only way to remove it is to delete the module files (cannot even access site or admin, cannot clear cache with drush, etc). Once I do that I get errors saying the module is missing... and I cannot uninstall it without having the files there. But with the files there I cannot access or manage anything on the site via the site or command line. I'm a bit screwed on this... any idea how to resolve?
Comment #24
sarathkmIf someone is facing this issue:
then change this module composer.json to:
Source
Comment #25
taxelson@umassp.edu commented@sarathkm You solved my issue!! I had a devil of a time getting Composer Manager to work on a hosted site that locks down the main site directories; since nothing is writeable, Composer Manager chokes. But once I solved all that I was still getting errors that seemed to be related to Composer Manager and/or the paths in the autoload files. But your post solved my problem completely. Thanks!!
Comment #26
jghyde commentedLearning composer and applying it to Drupal 7 ::whew!::
Here's how I fixed the problem:
1. In mysql, I ran these commands:
2. Download and install the Drupal drush registry rebuilder (https://www.drupal.org/project/registry_rebuild)
3. Run drush rr
4. Run drush cc all
Now start over with the install of composer_manager and fb_instant_articles, and use drush.
Comment #27
erwangel commentedThank you jghyde for the tip. #26 1-4 permit to have the site come back after a WSOD
Comment #28
jtsnow commentedAs of version 1.8.0, the facebook-instant-articles-sdk-php library no longer requires log4php. Updating to the latest version should fix any related errors.
See https://github.com/facebook/facebook-instant-articles-sdk-php/pull/304
Comment #29
les limRe-opening, since this is no longer about not using Composer Manager correctly.
Contrary to #28, it looks like 1.7.0 is the last version of the facebook-instant-articles-sdk-php library that has apache/log4php as a requirement. Until the 7.x code can be refactored to remove its use of \Logger, we should lock the SDK version to 1.7.0. Patch attached.
Comment #30
stijndmd commentedThank you for that Les Lim.
#29 saved my day.
Comment #31
oriolconesa commentedThe steps I followed to restore the site when getting the error (Might there be an easier way to solve it?)
1.- Comment line 184 @/sites/all/modules/contrib/fb_instant_articles/fb_instant_articles.module to restore the site
\Logger::configure($configuration);
2.- Disable all FIA modules through GUI
- Facebook Instant Articles
- Facebook Instant Articles API
- Facebook Instant Articles API Rules
- Facebook Instant Articles Display
- Facebook Instant Articles RSS
- Facebook Instant Articles Views
3.- Remove folder sites/all/modules/contrib/fb_instant_articles/
4.- Rebuild composer.json file through Composer Manager GUI
/admin/config/system/composer-manager
5.- Run composer update at /sites/default/files/composer to remove the dependencies
6.- Download the module again:
drush dl fb_instant_articles
7.- Apply patch #29 fb_instant_articles-2705477-29.patch
8.- Enable the module through drush!
drush en fb_instant_articles
10.- You may now enable other needed modules through GUI
- Facebook Instant Articles API
- Facebook Instant Articles API Rules
- Facebook Instant Articles Display
- Facebook Instant Articles RSS
- Facebook Instant Articles Views
Comment #32
jacob.embree commented#29 appears to be correct and his patch is good. Even 1.7.1 is missing the
Loggerclass so 1.7.0 is correct.Comment #33
proweb.ua commented#29 #31 works