Upgrade 2.1.1 to 2.4.8 - A database error has occurred

Hi, my name is Carlos, I’m from Brasil and I’m in charge to upgrade our OJS system. We are currently using OJS 2.1.1 version and I’m having a little trouble on upgrading it to the latest stable version that is OJS 2.4.8.
The requirements are checked, the database, PHP, they all have the latest versions installed.
I check all the options that agree to our system, and press “Install Open Journal Systems”. I always get this message:

Errors occurred during installation:
A database error has occurred: Duplicate entry ‘USER_REGISTER-0-0’ for key ‘email_templates_email_key’

I also tried to upgrade the database using these steps:
- Edit config.inc.php and change “installed = On” to “installed = Off”
- Run the following command from the OJS directory (not including the $):
$ php tools/upgrade.php upgrade
- Re-edit config.inc.php and change “installed = Off” back to
"installed = On

and this is the result:

Thank you for your time already, any help will be very welcome :slight_smile:

Hi @Sokonosako,

How did you go about upgrading the code?

You might also get more information from the failure message if you turn on show_stacktrace in config.inc.php.

Alec Smecher
Public Knowledge Project Team

Thanks for the reply.
I did turned on show_stacktrace, I just don’t know where to find the failure message from it.
About the code upgrading, I followed the steps from: https://pkp.sfu.ca/ojs/UPGRADE I’m using windows by the way.

First I decompressed GeoLiteCity.dat into plugins/generic/usageStats directory (which did not existed until now, I had to create that directory), next I started the Full Package steps including giving writeble permission to the required directories and archives. Then I created a directory to store uploaded files with writeble permission. Next applied the latest recommended patch which is https://github.com/pkp/ojs/compare/ojs-2_4_8-0...ojs-stable-2_4_8.diff , and finally all the right settings were set and pressed “Install Open Journal System” button. These are the steps.
I don’t know what I did wrong, so I’m kinda stuck here u_u

Instead of (re)entering the settings and clicking “Install Open Journal Systems”, look for a little text link at the top of the page which says something like, “If you are upgrading, click here”.

Sorry I should have said before, I also tried that option and this was the result:

Errors occurred during installation:
A database error has occurred: Access denied for user ‘ojs’@‘localhost’ (using password: YES)

Do you still have a working version of the files and database at version 2.1.1? If so, the process should be:

  1. Backup 2.1.1 files and database.
  2. Extract 2.4.8 into a new directory; set permissions for the “cache” and “public” folders to be web-writable.
  3. Download GeoLiteCity.dat into plugins/generic/usageStats
  4. Copy the “public” directory and “config.inc.php” from 2.1.1 to into 2.4.8
  5. Change config.inc.php’s “installed” parameter to “off”
  6. Remove 2.1.1 from your webserver path, and replace it with 2.4.8
  7. Run the php tools/upgrade.php upgrade script from the shell
  8. Change config.inc.php’s “installed” parameter to “on”
  9. Visit new working site to confirm operation
  10. (optional) Apply latest patches via the patch command

It is quite odd that you would be going from a working system to an error message of not being able to connect to the database if your config.inc.php database parameters are not changing. Can you connect manually to the database with the OJS username and password?

So I followed your steps and now I get a different error message, don’t know if it is good or bad, check it out:

Yes I can, I access it through site/phgmyadmin and there’s the database.

That looks as if the upgrade script was run from the 2.1.1 version. The upgrade script should be run from the directory of the new version (2.4.8).

I was actually replacing the content from 2.4.8 version to the original directory, but now I believe I did right. There’s a new directory to the new version, have all the requirements from item 1 to 7. The upgrade message shows something different now:

Thank for the quick replies, it’s helping very much.

Is it possible you previously applied a patch, or previously partially applied an upgrade, which changed the database?

If you restore your database back to a working 2.1.1 copy, and if that database has a currency_code_alpha column in the subscription_types table, your next step might be to delete the lines from dbscripts/xml/upgrade/2.2.0_preupdate.xml which try to re-add that column.

Then rerun the upgrade.

It’s been a while since my last attempt to upgrade my OJS system. I believe the upgrade is almost complete, but there’s still a problem. For the first time I successfully upgraded the php with the command: php tools/upgrade.php upgrade

#1062: localized article cover images
#1087: Crossref plugin doesn’t support newer content-types
#1088: Not all issues displayed for the DOI export/registration
#1092: OAI-PMH interface strips HTML, but leaves HTML entities
#1097: Escaped HTML is slipping into Crossref exports

Successfully upgraded to version
Next I changed the config.inc.php’s “installed” parameter to “on”.

The result is a blank page, there’s nothing, not even an error message. Then I tried to put the “config.inc.php” from 2.4.8 version, but I get a database error. Put back the “config.inc.php” from 2.1.1 version, and there’s the black page again, doens’t matter if I set “installed” parameter to “on” of “off”

So now I don’t know what to do right now u_u

When you see a blank page, check your server’s error log for the cause:

Forget my last reply hahah, I didn’t pay attention to the cache directories permission ;D

Thanks everybody who helped me.
Peace yaw

@Sokonosako How did you end up getting around this issue with the DB error on “currency_code_alpha” column?