[Solved] lib/pkp/lib/vendor/autoload.php missing when upgrading from 2.4.8.2 to 3.1

Hi,
I just did a test install of o master branch of OJS using Github. I want to upgrade from 2.4.8.2 to the latest stable OJS (3.1)

I renamed the old ojs 2 directory, installed OJS 3 from Git (including pkp-lib), edited config.inc.php for my local server, and tried to run the database upgrade using php tools/upgrade.php upgrade

Running that I gor the error: “PHP Warning: require_once(lib/pkp/lib/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/ojs/lib/pkp/classes/core/PKPApplication.inc.php on line 127

When I looked at lib/pkp/lib directory, there is no vendor directory.

Server is giving me error 500, regardless if I set installed = On or installed = Off in config.inc.php, while the old ojs 2 installation in a renamed directory is still working.

Is it possible that the upgrade script is looking for missing files?

Regards,
Ales Kladnik

Hi @AlesKladnik,

When working with a git checkout, you’ll need to install some dependencies. See https://pkp.sfu.ca/wiki/index.php?title=Github_Documentation_for_PKP_Contributors for details.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks Alec,
managed to get the dependencies installed (Composer and Node).

Then I got a different error:

PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/ojs/plugins/generic/citationStyleLanguage/lib/vendor/autoload.php’ (include_path=’/var/www/html/ojs/lib/pkp/lib/vendor/phpunit/phpunit-selenium:.:/var/www/html/ojs/classes:/var/www/html/ojs/pages:/var/www/html/ojs/lib/pkp:/var/www/html/ojs/lib/pkp/classes:/var/www/html/ojs/lib/pkp/pages:/var/www/html/ojs/lib/pkp/lib/adodb:/var/www/html/ojs/lib/pkp/lib/phputf8:/var/www/html/ojs/lib/pkp/lib/pqp/classes:/var/www/html/ojs/lib/pkp/lib/smarty:.:/usr/share/php’) in /var/www/html/ojs/plugins/generic/citationStyleLanguage/CitationStyleLanguagePlugin.inc.php on line 17

It seems that the plugin should load some libraries, but it fails to locate them?

I tried deleting the citationStyleLanguage plugin, and I got the OJS 3 working!

I’m trying to do a test upgrade from 2.4.8.2 to 3.1 in an Ubuntu Server 17.10. I used installed=Off in config.inc.php and pointed the browser to ojs directory. This shows me the OJS Installation page. I then clicked on the ‘click here’ link under Upgrade, and then Upgrade Open Journal Systems. Again, I got the 500 error, looking into logs, the problem was now the paypal plugin

PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/ojs/plugins/paymethod/paypal/vendor/autoload.php’

Deleted that plugin also, and i tried the CLI method for database upgrade (that was also not working before I deleted the paypal plugin). This time the php upgrade was working, but it’s throwing out all sorts of different errors (file permissions, php errors, …), finally ending with an error:

ERROR: Upgrade failed: DB: Duplicate entry ‘1702-3-2’ for key ‘review_rounds_submission_id_stage_id_round_pkey’

There was too much text output from the upgrade script, so I lost most of the text. Is the upgrade.php generating a log file somewhere?

Interestingly, OJS 3.1 is now working, but the webpage is without CSS:
2017-11-16

I can follow the links, I can even login as a user of the old OJS. However, PDF is not showing, I get an error “Message: stream must have data” - this probably related to the file permission errors that were showing during upgrade.

If I go the the Dashboard, I get a properly styled paged (in OJS 3 default theme), but whatever I click there I get a white screen with the error {“status”:true,“content”:"\n\n\t</span>\n\t\t\tHelp\n\t</a>\n\n.

So I’m lost with the upgrade process… I don’t want to see this happening in our production site. I wanted to use the Git method of installation, so that the upgrades would be easier, but I guess I don’t know how to use Git properly.

What would be the best way to upgrade from 2.4 to 3.1? I really want to upgrade the system…

Regards,
Ales

An update:

I tried installing OJS 3.1 from a tarball, but now I’m getting different errors when running upgrade.php:

PHP Notice: unserialize(): Error at offset 651 of 1506 bytes in /var/www/html/ojs/lib/pkp/classes/db/DAO.inc.php on line 352
PHP Stack trace:
PHP 1. {main}() /var/www/html/ojs/tools/upgrade.php:0
PHP 2. UpgradeTool->execute() /var/www/html/ojs/tools/upgrade.php:34
PHP 3. UpgradeTool->upgrade() /var/www/html/ojs/lib/pkp/classes/cliTool/UpgradeTool.inc.php:64
PHP 4. Installer->execute() /var/www/html/ojs/lib/pkp/classes/cliTool/UpgradeTool.inc.php:88
PHP 5. Installer->executeInstaller() /var/www/html/ojs/lib/pkp/classes/install/Installer.inc.php:186
PHP 6. Installer->executeAction() /var/www/html/ojs/lib/pkp/classes/install/Installer.inc.php:265
PHP 7. call_user_func:{/var/www/html/ojs/lib/pkp/classes/install/Installer.inc.php:415}() /var/www/html/ojs/lib/pkp/classes/install/Installer.inc.php:415
PHP 8. Upgrade->concatenateIntoMasthead() /var/www/html/ojs/lib/pkp/classes/install/Installer.inc.php:415
PHP 9. DAOResultFactory->next() /var/www/html/ojs/classes/install/Upgrade.inc.php:2201
PHP 10. JournalDAO->_fromRow() /var/www/html/ojs/lib/pkp/classes/db/DAOResultFactory.inc.php:104
PHP 11. ContextDAO->_fromRow() /var/www/html/ojs/classes/journal/JournalDAO.inc.php:40
PHP 12. DAO->getDataObjectSettings() /var/www/html/ojs/lib/pkp/classes/context/ContextDAO.inc.php:70
PHP 13. DAO->convertFromDB() /var/www/html/ojs/lib/pkp/classes/db/DAO.inc.php:590
PHP 14. unserialize() /var/www/html/ojs/lib/pkp/classes/db/DAO.inc.php:352

The upgrade script finishes with an error:

ERROR: Upgrade failed: DB: Table ‘review_assignments_tmp’ already exists

Again, there is no CSS style in the frontend, plus the additional database error:

DB Error: Unknown column ‘a.include_in_browse’ in ‘where clause’

image

Regards,
Ales

Hi @AlesKladnik,

There are several issues described here, so I’ll try to work through them:

PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/ojs/plugins/generic/citationStyleLanguage/lib/vendor/autoload.php’

…and…

PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/ojs/plugins/paymethod/paypal/vendor/autoload.php’

These are both for missing composer dependencies. They weren’t noted on the wiki page for git users but I’ve added them. Rather than deleting the plugins, I’d recommend running the composer update to install dependencies.

The unstyled installation looks like something didn’t go correctly in the install, so it’s incomplete. Check your error log for details – if there are lots of warnings, look for a message containing Error.

PHP Notice: unserialize(): Error at offset 651 of 1506 bytes in /var/www/html/ojs/lib/pkp/classes/db/DAO.inc.php on line 352

These will happen if you inadvertently change your character encoding settings in config.inc.php.

ERROR: Upgrade failed: DB: Table ‘review_assignments_tmp’ already exists

This suggests you don’t have a clean database. Make sure you DROP the database fully and re-create it before loading from your database dump.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks Alec for a quick answer, but still no luck. :confused:

Dropping and recreating the database helped a bit, the upgrade process ran for a longer time and I got some unserialize() errors as before:

PHP Notice: unserialize(): Error at offset 3295 of 4529 bytes in /var/www/html/ojs/lib/pkp/classes/db/DAO.inc.php on line 352

It turned out that I had some tables in the database with latin1_swedish_ci encoding, for example articles_migration that is probably a newly generated table. I fixed server connection collation to utf8_general_ci, dropped the corrupted database, created a new one by specifying the encoding:
CREATE DATABASE ojs CHARACTER SET utf8 COLLATE utf8_general_ci;

Deleted the files directory and restored from a backup and set the permissions on files to 777.

Ran the upgrade, and it went really good, no more errors, warnings or denied permissions. :grinning:

But then the upgrade ended with a different error as before: :grimacing:

ERROR: Upgrade failed: DB: Duplicate entry ‘1702-3-2’ for key ‘review_rounds_submission_id_stage_id_round_pkey’

Again, the result was an unstyled HTML output - the upgrade script was apparently interrupted and didn’t go through to the end. Searching the database for the above entry or key gives me zero results, so I can’t even find these values in the database to try deleting them. Do you know where to look for these database entries?

Regards,
Ales Kladnik

Hi @AlesKladnik,

That’s due to some bad data in your OJS 2.x installation. See Upgrade to 3.0.0: pkey violation on review_rounds · Issue #1921 · pkp/pkp-lib · GitHub for some queries that’ll resolve it. (Run these after loading your pre-upgrade backup, but before running the upgrade script.)

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks Alec!!! You nailed the problem as always!

I did have 9 duplicates in the ‘review_rounds’ table. The sql commands from the post found and removed them. The upgrade script then finished its work without any errors.

Now I have a functional frontend, looking nice with the default ojs3 theme:
2017-11-18 (1)

But the backend is corrupted, only unstyled content:
2017-11-18

I’ll try to use a different theme later, maybe switching the theme might help.

There are some minor things missing in the frontend, like Journal description and some static page content, but I’m sure I can fix that later.

For now I’m really happy that the upgrade went through and thank you for all you help!

Cheers,
Ales

I found the cause, there is a fatal error in the log related to LESS:

PHP Fatal error: Uncaught exception ‘Less_Exception_Parser’ with message ‘File styles/index.less not found.’ in /var/www/html/ojs/lib/pkp/lib/vendor/oyejorge/less.php/lib/Less/Parser.php:2606

I’m testing this in a fresh install from a tarball downloaded from OJS download site, so it should not be related to the problem with not installed dependencies as I had in the beginning with the installation from git.

I found a similar error here: CSS and Java Script not loaded in OJS 3.0.2 backend - #4 by Vitaliy, although in my case the problem is only with CSS loading.

I inspected the network communication using Chrome, and there are two files that are not loaded in the backend:
/ojs/styles/build.css shows a 404 error
/ojs/index.php/IAS/$$$call$$$/page/page/css shows a 500 error

Regards,
Ales

I’m sorry @asmecher , the error was my fault, now I solved it:

Now I really did a completely fresh installation from a tarball in a separate directory, and now I have functional frontend and backend. Wheew! :sweat_smile:

Thanks for all the help!
Ales

Hi @AlesKladnik,

Great, glad it’s all working!

Regards,
Alec Smecher
Public Knowledge Project Team

Hi, I had the same problem:

[Tue Mar 19 16:24:07.680042 2019] [cgi:error] [pid 23368] 
[client 192.94.163.143:33756] AH01215: #5 /ojs/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): 
PKPRouter->_authorizeI in /ojs/lib/pkp/lib/vendor/oyejorge/less.php/lib/Less/Parser.php on line 2606, referer: http://localhost/ojs/index.php/TestJournal/index

I am using ojs3_1_1_4
Php 5.6
I am using a new Theme with my templates.
I ran npm run build

Any help ??

I resolved the poblem.

  • I disabled my environment variables proxy and change permissions on my theme.
  • I run npm and composer
  • I enabled proxy

Regards
xavi.