Various issues preventing deployment of Newscoop

  • We are looking to use Newscoop for our
    company's blog system. However, we are running into various issues with
    the latest release available on github ( 4.4.7 ), and are running into
    various issues:

    1)
    Following the installer as per the documentation results in failure as
    the installer seems unable to complete importing of mysql on its own --
    We have had to import the sql files to the database during the
    installation process to allow it to complete. This is a workaround, but
    should be noted for testing in future releases.  Unfortunately I do not
    have an error on hand, but it involved the installer not being able to
    find one of the tables that it was supposed to be importing, a version
    table if i recall correctly, with no import being actually executed.

    2)
    Going to a publication's configure page ( Content -> Publications
    -> Configure icon for publication ) results in a PHP "white screen of
    death" with an SQL error being thrown in apache's error log, but only
    if the publication has issues created.


    error thrown: [Thu Oct 20 00:37:35.681397 2016] [:error] [pid 15909] [client 107.179.138.10:37786]
    PHP Fatal error:  Uncaught exception 'PDOException' with message
    'SQLSTATE[42S22]: Column not found: 1054 Unknown column
    't0.fk_output_id' in 'field list'' in
    /var/www/scoop.redpiranha.net/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:694\nStack
    trace:\n#0
    /var/www/scoop.redpiranha.net/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(694):
    PDOStatement->execute()\n#1
    /var/www/scoop.redpiranha.net/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(748):
    Doctrine\\DBAL\\Connection->executeQuery('SELECT t0.id AS...',
    Array, Array)\n#2
    /var/www/scoop.redpiranha.net/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(196):
    Doctrine\\ORM\\Persisters\\BasicEntityPersister->load(Array, NULL,
    NULL, Array, 0, 1, NULL)\n#3
    /var/www/scoop.redpiranha.net/src/Newscoop/NewscoopBundle/Form/Type/PublicationType.php(68):
    Doctrine\\ORM\\EntityRepository->findOneBy(Array)\n#4
    /var/www/scoop.redpiranha.net/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php(140):
    Newscoop\\NewscoopBundle\\Form\\Type\\Publ in
    /var/www/scoop.redpiranha.net/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
    on line 91, referer: http://scoop.redpiranha.net/admin/publications/

    3) Theming issues -- "white screens of death" are prevelant when trying to use themes offered by sourcefabric. Example: http://scoop.redpiranha.net/en/main/ 
    No errors are logged in apache's error log. No html output is provided.
    So far, we have been unable to discover how to enable php error logging
    within the theming engine. We have tried multiple themes, as well as
    reinstalling newscoop multiple times in case there was a mistake during
    installation, however we have had varying levels of success with
    avoiding these white screens by trying different themes. I have seen
    some suggestions where modifying the settings for the publication may be
    able to alleviate some of these white screens, but point 2 above
    prevents me from testing any such suggestions.

    We are currently attempting to work with the "Liquid" theme.

    Any
    advice and further debugging suggestions would be greatly appreciated,
    as we are finding it difficult to proceed further with deployment
  • 15 Comments sorted by
  • I ran into many of these issues (and others) while attempting an install on a Hostmonster.com shared server. Here are some of my fixes, documented in the hopes they help others:

    1. SQL TABLE CREATION ERRORS

    The install/Resources/sql/campsite_core.sql file has an extra line that is not needed and that will cause problems on most shared hosting servers (and many other, properly configured servers). If you're getting table creation errors, edit this file and delete line 18. Line 18 says:
    SET @@global.sql_mode= '';
    Unless you gave your db user WAY more permissions than it needed, this line is giving you an error and it's completely unnecessary. Just delete the whole line and start over.

    2. CRONTAB JOB ERRORS

    Some Crontab files have variables defined in them, not just the normal "do x at y intervals" lines. If you use CPanel to manage your server, then you almost definitely have these variable lines in there. The problem is, the yzalis crontab extension can not handle these variable lines, and instead throw an error that looks like "Wrong job number of arguments." This is an easy fix. You'll want to edit two files.

    First, open the vendor/yzalis/crontab/src/Crontab/Job.php file. Line 43 looks like this:
             throw new \InvalidArgumentException('Wrong job number of arguments.');
      You'll want to replace line 43 with this instead:
             return;

    Next, open the vendor/yzalis/crontab/src/Crontab/CrontabFileHandler.php file. Line 49 looks like:
                $crontab->addJob($job);
    You want to leave that line alone, but directly above it you'll want to add a new line that says:
                if (is_null($job)) return;

    So what did you just do? You told the yzalis Crontab handler that if it sees a line in the crontab file that doesn't make sense to it, to just ignore that line instead of throwing an error. Now restart your install.

    3. PRIMARY KEY DUPLICATION ERRORS

    During the installation process, the Newscoop code adds a few lines into a table. The problem is, the code doesn't delete those lines first. So what happens if the code added those lines to the table, but then breaks, and so you have to re-run the installer? You'll get this error, from the code trying to insert lines that already exist. This is another easy fix.

    You'll want to open the /library/Newscoop/Installer/Services/DatabaseService.php file. Line 129 looks like this:
            $connection->executeQuery("INSERT INTO `ArticleTypeMetadata` (`type_name`, `field_name`, `field_weight`, `is_hidden`, `comments_enabled`, `fk_phrase_id`, `field_type`, `field_type_param`, `is_content_field`, `max_size`, `show_in_editor`) VALUES ('news', 'NULL', NULL, 0, 1, NULL, NULL, NULL, 0, NULL, 1),('news', 'lead', 1, 0, 0, NULL, 'text', NULL, 0, 160, 0),('news', 'content', 2, 0, 0, NULL, 'body', 'editor_size=500', 1, NULL, 0);");
    You want to leave that line alone, and instead add a new line directly above it that says:
            $connection->executeQuery("TRUNCATE TABLE ArticleTypeMetadata;");

    So what did you just do? You changed the code from saying "Add these lines to the ArticleTypeMetadata table" into "First delete anything in the ArticleMetadata table, then add these lines"

    4. EMPTY TEMPLATE CREATION ERRORS

    I have a feeling this is caused by the daemon not having the proper rights to create files in the Templates directory. That's okay, you can do this manually.

    First, go to the themes/unassigned directory. Create a new directory inside that directory named empty.

    Next, inside the empty directory, create a file called theme.xml, and place these lines inside it:
    <theme name="Empty" designer="default" version="1.0" require="3.6">
        <description>This is an empty theme</description>
        <presentation-img src="preview-front.jpg" name="Front page"/>
        <presentation-img src="preview-section.jpg" name="Section page"/>
        <presentation-img src="preview-article.jpg" name="Article page"/>
        <output name="Web">
            <frontPage src="front.tpl"/>
            <sectionPage src="section.tpl"/>
            <articlePage src="article.tpl"/>
            <errorPage src="404.tpl"/>
        </output>
    </theme>

    Next, you want to create a bunch of files. You can leave them blank. The easiest way to do this it to "touch" a file on the command line. This creates a blank file with that name. (For example, "touch preview-front.jpg") You'll want to create the following files:
    • preview-front.jpg
    • preview-article.jpg
    • preview-section.jpg
    • front.tpl
    • section.tpl
    • article.tpl
    • 404.tpl
    You've just created a completely blank ('empty') theme for Newscoop, which it will use by default. All this will leave you with a blank homepage once you're done successfully installing Newscoop, but just head over to their template page, download the one you like, and install it using the admin console.

    5. GENERATE PROXIES FAILURE

    It turns out that the default php on many shared hosting sites is an old version of PHP, which cannot handle symfony installations (the underlying structure for Newscoop) properly. On Hostmonster.com, the latest (version 5.6) version of PHP is actually found at /usr/php/56/bin/php. On the server you're using, it may be found somewhere else. The trick is to figure out where the proper version of PHP is installed, and to force the Newscoop installer to use this version.

    For example, on my shared hosting server, if I type "php --version", I get:
    PHP 5.2.17 (cgi-fcgi) (built: Sep 26 2016 15:33:30)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

    However, if I type "/usr/php/56/bin/php --version", I get:
    PHP 5.6.27 (cli) (built: Oct 20 2016 20:14:23) 
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
        with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.1.2, Copyright (c) 2002-2016, by ionCube Ltd.
        with SourceGuardian v11.0.2, Copyright (c) 2000-2016, by SourceGuardian Ltd.
        with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
        with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

    You don't want a pre-PHP 5.4 version, or else you'll get this error. The easiest way to use the correct PHP version is through a setting in your CPanel. If that does not work, you'll need to manually code in the location of your correct php binary. I'll use the Hostmonster.com location as an example.

    You'll want to open the /library/Newscoop/Installer/Services/FinishService.php file. Near the top of the file (not at the very top, but the second line is fine), add this line:
    define('PHPLOCATION','/usr/php/56/bin/php');

    Next, you'll want to do a search-and-replace. You're searching for the phrase:
    escapeshellarg($phpPath);
    You're replacing that phrase with this one:
    escapeshellarg(PHPLOCATION);
    This search-and-replace should occur four times within the file.

    6. BAD CREDENTIALS ERROR AT FIRST LOGIN

    If you got the install to complete but you just can't seem to log into the admin portion of the site, instead log into your Newscoop MYSQL database and run this query:
    UPDATE liveuser_users SET Password = 'sha1$L8ve0WLGOkbE$80b56a21a265417d31f8a04f2733c435977d7c7c' WHERE UName = 'admin';

    So what did you just do? You just reset the admin account password to be 'password'. Remember to change this IMMEDIATELY after you log in!!!



    Well, I hope my hard-earned lessons will help the next person stuck on one of these errors. Good luck!!!
    *Edit - formatting
    Post edited by James Brabson at 2016-12-05 22:07:59
  • This forum software wouldn't let me continue (my comment was getting too long), so here's the rest:

    7. Unknown column 't0.fk_output_id' in 'field list'


    Don't ask me why, but the current Newscoop 4.4.7 installation sql file actually has the wrong definition for the output_publication table. Did you do a successful install, but then get a white screen of death? And when you try to edit your publication are you getting white screen of death? This is the problem AND the fix!

    The error's in your PHP error_log will look like:
    PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.fk_output_id' in 'field list'' in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:694
    Stack trace:
    #0 vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(694): PDOStatement->execute()
    #1 vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(748): Doctrine\DBAL\Connection->executeQuery('SELECT t0.id AS...', A
    rray, Array)
    #2 vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(196): Doctrine\ORM\Persisters\BasicEntityPersister->load(Array, NULL, NULL, Array, 
    0, 1, NULL)
    #3 src/Newscoop/NewscoopBundle/Form/Type/PublicationType.php(68): Doctri in vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php on line 91

    If you've already installed Newscoop, here's the fix:
     Newscoop actually included the fix, they just didn't run it. In the install/Resources/sql/upgrade/4.4.x/2015/10/29 directory, there's a tables.sql file. That's the correct table definition. However, it's missing the DROP TABLE first line that it should have. So, log into your newscoop mysql database using your mysql newscoop user. Here's what you'll want to run (feel free to copy-paste into mysql):
    DROP TABLE IF EXISTS `output_publication`;
    CREATE TABLE IF NOT EXISTS `output_publication` (
      `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      `fk_output_id` int(11) unsigned NOT NULL,
      `fk_publication_id` int(11) unsigned NOT NULL,
      `fk_language_id` int(11) unsigned NOT NULL,
      `fk_theme_path_id` int(11) unsigned DEFAULT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `publication_language` (`fk_publication_id`,`fk_language_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    Now delete your publication/issues and start over by creating a new publication, assigning a theme to it, then creating an issue. White screen of death magically gone!

    If you haven't installed Newscoop yet, here's the fix to avoid this:
    You'll want to edit the install/Resources/sql/campsite_core.sql file.

    Currently, lines 2574 look like this:
      `fk_publication_id` int(11) unsigned NOT NULL,
    Leave this line alone, but above it add a new line that says:
      `fk_output_id` int(11) unsigned NOT NULL,

    Don't ask me why, but the SQL file that's used to create your database during install is missing this line. They obviously knew this and added it to the "upgrade" directory, but that file never runs, and you're not upgrading, so... yeah. Makes no sense, but at least it's fixed!


    After all of the above problems, I can now say that I can easily (re)install Newscoop and get a basic template to display! Now on to trying for a fancier template... (wish me luck!)

    *edit - fought for nicer formatting for a while, then gave up
    Post edited by James Brabson at 2016-12-05 22:29:13
  • Hi Jonathan,

    Please, try to use the latest version of Newscoop from v4.4 branch which is available here: https://github.com/sourcefabric/Newscoop


    The problem with white screen on frontend can be related to missing legacy plugins. Before they were available as a part of core, now it is separated from core as a external scripts. Liquid theme is using those legacy plugins. If plugins are not available, it will show you a blank page. See here how to install those legacy plugins: https://github.com/sourcefabric/Newscoop/blob/master/newscoop/docs/UPGRADE_4_3.md#updating-newscoop-legacy-plugins

    Let me know if it helped or not.

    Best
  • Hi Rafał

    It was able to assist with progressing, now we can see content when we go to /en/main -- however, the front page is still blank.

    http://scoop.redpiranha.net/&nbsp;
  • After doing a reinstall, here is the output from the php application/console newscoop:install installation method, which has near identical error output to the web based installation method:


    [Doctrine\DBAL\DBALException]
    An exception occurred while executing 'INSERT INTO Versions (ver_name, ver_value) VALUES ("last_db_version", ?) ON DUPLICATE KEY UPDATE ver_value = ?' with params ["4.4.x", "4.4.x"]:
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newscoop.Versions' doesn't exist


    [PDOException]
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newscoop.Versions' doesn't exist


    This is with a empty database, which the installer is supposed to import the data into, is it not?

    I've worked around the blank frontpage with a htaccess to redirect to the issue we are using as a default issue, but if we need to have multiple publications, this will end up starting to need a lot of hackish edits to work around the blank front page -- any suggestions on how to override newscoop's "eating" of these errors?
  • Упс, похоже, что-то пошло не так.

    2/2 DBALException : Произошло исключение при выполнении "INSERT INTO версии (ver_name, ver_value) VALUES (" last_db_version ",?) Дублированием KEY UPDATE ver_value =? с Params [ "4.4.x", "4.4.x"]:

    SQLSTATE [42S02]: Base таблицы или представления не найдено: 1146 Таблица 'worldtexru_novos.Versions' не существует

    1. в /home/w/worldtexru/news/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php линии 91
    2. в DBALException :: driverExceptionDuringQuery ( объект ( PDOException ), 'INSERT INTO версии (ver_name, ver_value) VALUES ( "last_db_version",?) дублированием KEY UPDATE ver_value =?', массив ( '4.4.x', '4.4.x' )) в /home/w/worldtexru/news/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php линии 702  
    3. в связи -> ExecuteQuery ( 'INSERT INTO версии (ver_name, ver_value) VALUES ( "last_db_version", версия): дублированием KEY UPDATE ver_value =: версии', массив ( 'версия' => '4.4.x')) в / главная / ж / worldtexru / новости / public_html / библиотеки / Newscoop / Установщик / Услуги / DatabaseService.php линия 502  
    4. в DatabaseService -> saveDatabaseVersion ( объект ( Connection ), '4.4.x', '2015.10.29') в /home/w/worldtexru/news/public_html/library/Newscoop/Installer/Services/DatabaseService.php линии 82 
    5. в DatabaseService -> fillNewscoopDatabase ( объект ( подключение )) в /home/w/worldtexru/news/public_html/install/index.php линии 254 
    6. в {} замыкание ( объект ( Request ))
    7. в call_user_func_array ( объект ( закрытие ), массив ( объект ( Request ))) в /home/w/worldtexru/news/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php линии 145 
    8. в HttpKernel -> handleRaw ( объект ( Request ), '1') в /home/w/worldtexru/news/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php линии 66 
    9. при HttpKernel -> ручка ( объект ( Request ), '1', правда ) в /home/w/worldtexru/news/public_html/vendor/silex/silex/src/Silex/Application.php линии 547  
    10. при применении -> ручки ( объект ( Request )) в /home/w/worldtexru/news/public_html/vendor/silex/silex/src/Silex/Application.php линии 524 

    как решить проблему
  • Упс, похоже, что-то пошло не так.

    Hey there.


    We have found that if we run the installer, let it hit that error, then manually import the SQL files found in the "install/Resources/sql/campsite_core.sql" directory, then refresh the page ( making sure to re-send form data when prompted) the installer is then able to continue.


    Definitely not optimal, but it does complete the installation.

  • Darned forum software posted posted my last comment twice, and I can't delete, so I'll just leave this blank :)
    Post edited by James Brabson at 2016-12-05 22:12:45
  • Dear James,
    Thank you for all that information and solutions.
    ..
    Which version of Newscoop is then production ready?

    I'm worried because the sourcefabric team does not respond on those messages...
  • Hi, Robert,

    I wish I had a good answer there. I've been using the 'latest and greatest' 4.4.7 straight from https://www.sourcefabric.org/en/newscoop/download/, and obviously it's not ready for production.

    The big question I haven't figured out yet is whether I need to implement ALL of the changes found in the install/Resources/sql/upgrade/4.4.x subdirectories manually after installation, or whether most are already included and it's just that last one that accidentally didn't get added.

    Except for the upgrade/4.4.x error (7. Unknown column 't0.fk_output_id' in 'field list'), most of the rest of my problems arose from installing on a shared server. I think it's clear that the Newscoop installation was only tested in very specific environments. In a big newsroom, that's probably an accurate use case, it just makes life difficult for the rest of us. My biggest concern from the first six errors I came across was actually the unnecessary security requirement of giving the MySQL user privileges over other, non-Newscoop databases (1. SQL TABLE CREATION ERRORS).

    My other big concern is that Newscoop uses an old version of Symfony as its framework, supported by old versions of numerous other PHP libraries. There are enough different libraries that I haven't had the time to check each one and see whether there are security flaws present in those older versions. It appears that trying to update Newscoop to work with updated versions of all those libraries would be a monumental task.

    Most of the original Newscoop templates (such as 'New Guardian') require old plugins that are too complicated to try to install properly. The recommended installation procedure for the old plugins on the website didn't work, and I decided it wasn't worth the effort to fix -- better to just ignore deprecated plugins and start a decent template from scratch. That's the step I'm on now.

    Since the last update was in 2015, I think we have to call Newscoop 'old/unsupported software'. I still like the concept and am currently trying to create a new template and make it all work, and will continue to post whenever I find an error and a fix. I'm hoping that Sourcefabric's current focus, Superdesk, will communicate with Newscoop and eventually lead them back to updating this code, but I'm not holding my breath.
  • Quick note --

    I answered my own question in the above comment about the missing SQL changes. It turns out there are 6 different SQL changes that were missed in the current campsite_core.sql file.

    Go to /install/Resources/sql/upgrade/4.4.x and do a directory listing. There are lots of directories all named "YYYY.MM.DD", signifying the date when that change was added. All changes after July 2015 are missing from the campsite_core.sql file and will need to be implemented manually.

    You'll need to manually run the changes found in the following directories:
    • 2015.08.10
    • 2015.08.24
    • 2015.09.11
    • 2015.09.15
    • 2015.10.15 (note - this directory includes a php file that gets run from within mysql, so you'll need to be in the same directory as that file or will need to give mysql a more specific path name for it)
    • 2015.10.29 (note - add a DROP TABLE line to the beginning as shown in the previous comment to avoid errors)

    Mind you, doing all of that still won't make Newscoop 4.4.7 actually run and work and display themes. But it will make it install successfully.

    *Edit - Actually, after MUCH annoyance and difficulty, I have Newscoop 4.4.7.ish running and working! I'll try to document in more detail later, but the trick to avoiding the white screen of death is to update your Newscoop with a newer, currently unnumbered version. AHilles107 has created a branch of the code that will show template errors instead of the white screen of death: https://github.com/ahilles107/Newscoop/tree/error_handling_improvements. Download it, then follow the upgrade directions here: https://github.com/sourcefabric/Newscoop/blob/v4.4/newscoop/docs/UPGRADE_4_4.md in order to make it work properly. (All of the above fixes are probably still needed, this is just to fix the painful "I did everything right but now the screen is blank and I can't debug it with no information and I hate myself for ever trying this" problem we've all faced so very often.)

    Post edited by James Brabson at 2017-01-18 20:23:53
  • I found a better and easier way to avoid PDO problems: do NOT install the last MYSQL version. Use 5.6 instead.

    I will keep my fingers crossed, but Newscoop 4.4.7 is now working like a charm. 
  • The article pages remain blank, but the front page is showing.
  • I hate to do this, but I'm having the same issues as others with the installer.

    I'm not doing this professionally, and am loading newscoop 4.4.7 onto a raspberry pi3 using the guide on the website and everything else seems to have worked.  However I've had no luck getting newscoop installer to get past the first three pages (system compatibility, license agreement, database info).


    I tried manually loading the campsite_core.sql into the a mysql database. I created a new database called campsite_core and used 'source' to get the suggested .../campsite_core.sql information. I have NO idea where the campsite_core.sql data was supposed to be placed and no previous installation to check with, so THIS may be my current and only issue. I verified that it did in fact load the tables. Then I refreshed the page as suggested, and got nothing. 

    If it is more hassle I guess I'll look for a different resource to use.

    I attached a pic just in case one of the more knowledgeable people can spot an error I may have missed.
  • James Brabson,

    What do you mean by manually running changes?

    Adding queries in those files to the campsite_core.sql file?


    Post edited by Jarrett at 2017-04-25 21:43:56