Actions

Upgrading from a previous version: Difference between revisions

From LimeSurvey Manual

No edit summary
(Added information on MySQL error)
 
(51 intermediate revisions by 6 users not shown)
Line 9: Line 9:


<!--T:4-->
<!--T:4-->
You can do this using a database administration tool like [https://www.phpmyadmin.net phpMyAdmin] and a file manager! If you don't know how to do this, you should not proceed further and ask someone who knows or use the [[ComfortUpdate]] instead.
You can do this using a database administration tool like [https://www.phpmyadmin.net phpMyAdmin] and a file manager!  
If you don't know how to do this, you should not proceed further and ask someone who knows.


=The quick way (for minor version changes)= <!--T:5-->
==Recommendation to use ComfortUpdate== <!--T:28-->
'''The easiest/safest way to upgrade is to use our [[ComfortUpdate]] service.'''
 
=Upgrade instructions (from 2.x or newer to any later version)= <!--T:5-->


<!--T:6-->
<!--T:6-->
You can use these instructions if you are doing a minor upgrade (for example from 2.00 to 2.01):
Please follow these instructions:
*Backup your files and database ([[Upgrading from a previous version#Before you start...|did we already mention that?]]).
*Backup your files and database ([[Upgrading from a previous version#Before you start...|did we already mention that?]]).
*Delete all the old files/folders except for:
*Delete all the old files/folders except for:
**/application/config/security.php -'''Important!! This is the key to all encrypted data in LimeSurvey (version 4 and later)'''
**/application/config/config.php;
**/application/config/config.php;
**/upload directory -  
**/upload directory
 
<!--T:27-->
<div class="simplebox">[[File:help.png]]'''Note:''' If you have any customized templates in /upload/templates, make sure you 'refresh' those with any changes that come with the new LimeSurvey version. The easiest way to check for such changes is to file-compare your old template with the new version of the default template. If you see any differences other than your customizations, a refresh is needed.</div>
<div class="simplebox">[[File:help.png]]'''Note:''' If you have any customized templates in /upload/templates, make sure you 'refresh' those with any changes that come with the new LimeSurvey version. The easiest way to check for such changes is to file-compare your old template with the new version of the default template. If you see any differences other than your customizations, a refresh is needed.</div>
*Copy the new files from the new LimeSurvey package to the existing location.
*Copy the new files from the new LimeSurvey package to the existing location.
Line 24: Line 31:
*After the upgrade: '''Clear your browser cache and cookies!'''
*After the upgrade: '''Clear your browser cache and cookies!'''


=The thorough way (for big version jumps)= <!--T:7-->
=Instructions for older versions= <!--T:7-->


<!--T:8-->
<!--T:8-->
Line 30: Line 37:


==Upgrading from version 1.50 or later to any later 2.xx version== <!--T:9-->
==Upgrading from version 1.50 or later to any later 2.xx version== <!--T:9-->
#[https://www.limesurvey.org/about-limesurvey/download Download] the latest version of LimeSurvey
*[https://www.limesurvey.org/about-limesurvey/download Download] the latest version of LimeSurvey
# Prepare and backup the old installation:
*Backup your files and database ([[Upgrading from a previous version#Before you start...|did we already mention that?]]).
## Backup your installation directory files and SQL-based database just in case:
* Replace all the installation directory files
### At the command-line level, make a '''.zip''' or similar archive of the whole installation directory tree of files. For example, in Linux 'tar cvzf foo.tgz cps100' will tar and zip the whole cps100 directory
** Delete all old files in the existing installation directory
### You can use [https://www.phpmyadmin.net phpMyAdmin] to export all tables or you can use the backup database function of LimeSurvey that is available in the configuration dialog (under the advanced tab) to backup the entire database
** Upload and unpack the new files of the new version into the same installation directory
<div class="simplebox">[[File:help.png]] '''Note:''' Look for the '''LimeSurvey Administration''' button [[File:button-export-sql.png]] to export the database in the older LimeSurvey versions</div>
** If your previous version is older than 1.90, copy any customized templates to /upload/templates - you will also need to rename each template directory whose name matches an existing template in /templates
# Copy your '''config.php''' file, modified '''template''' directories, and the /upload directory separately for quick access later
** Copy your /upload directory back to the old location
# Replace all the installation directory files:
** Double-check the '''permissions''' set on the directories (write access to '''/tmp''', '''/upload''', and their subdirectories is required) as described in the [[Installation#Set directory permissions|installation wiki]]
## Delete all old files in the existing installation directory
** Open http://<yourdomain>/<yourlimesurveydir>/admin in your browser and follow the instructions (You will find the database data in the old config.php). The existing database will be automatically detected and if necessary, upgraded after confirmation.
## Upload and unpack the new code version into the same installation directory
* Check if any special manual checks apply as listed below
## If your previous version is older than 1.90, copy any customized templates to '/upload/templates' - you will also need to rename each template directory whose name matches an existing template in /templates
* '''Now, clear your browser cache and cookies''' and you are good to go
## Copy your '/upload' directory back to the old location
## Double check the '''permissions''' set on the directories (write access to '''/tmp''', '''/upload''', and their subdirectories is required) as described in the [[Installation#Set directory permissions|installation wiki]]
## Open http://<yourdomain>/<yourlimesurveydir>/admin in your browser and follow the instructions (you can use the old config.php as reference). The existing database will be automatically detected and if necessary, upgraded after confirmation
# Check if any special manual checks apply as listed below
# '''Now, clear your browser cache and cookies!''' and you are good to go
 
<!--T:23-->
{{Alert|title=Attention|text=If you upgrade from e.g. 1.92, it might be necessary to upgrade ''first'' to the latest 1.92 release, then to 2.00, then to 2.06, and then finally to the latest version (e.g. 2.55.x). Read below for [[Upgrading from a previous version#Upgrading from version 1.50 or later to any later 1.xx version|further details]].}}


<!--T:24-->
<!--T:24-->
Line 55: Line 54:
<!--T:10-->
<!--T:10-->
<div class="simplebox">'''Special checks after an upgrade''':
<div class="simplebox">'''Special checks after an upgrade''':
*'''from any earlier version to 2.xx''':  
*'''from any earlier version to 2.xx''': Proper question codes are mandatory now. After upgrading the installation, check the survey logic of all surveys and correct the codes where necessary
**Proper question codes are mandatory now. After upgrading the installation, check the survey logic of all surveys and correct the codes where necessary.
*'''from a version earlier than v1.53''': When upgrading from a version before v1.53 to the latest version, please check the '''global user rights''' of each user. There was a new '''superadmin''' right introduced in v1.53 that can give a user the same privilege as the master administration account created during the installation. The upgrade script is guessing to whom this permission should be given in the older versions.  As this is not perfect, it should be carefully checked.
*'''from a version earlier than v1.53''': When upgrading from a version before v1.53 to the latest version, please check the '''global user rights''' of each user. There was a new '''superadmin''' right introduced in v1.53 that can give a user the same privilege as the master administration account created during the install. The upgrade script is guessing to whom should be given this permission in the older versions.  As this is not perfect, it should be carefully checked;
*'''from any earlier version to v2.06''': From 2.05 to 2.06, some unused permissions when editing global permissions for 'surveys' were activated. For example, if a user had only the 'create' permission in 2.05, the other permissions located to the right of 'create' would also get activated with the update to 2.06 (View/read, Update, Delete, Import, Export). Please check whether the admin users got any other global permissions besides the 'original' ones after the update. If yes, please edit them accordingly.
*'''from any earlier version to v2.06''': From 2.05 to 2.06, some unused permissions when editing global permissions for 'surveys' were activated. For example, if a user had only the 'create' permission in 2.05, the other permissions located on the right of 'create' would also get activated with the update to 2.06 (View/read, Update, Delete, Import, Export). Please, check whether the admin users got any other global permissions besides the 'original' ones after the update. If yes, please edit them accordingly.
</div>
</div>


==Upgrading from version 1.50 or later to any later 1.xx version== <!--T:11-->
==Upgrading from version 1.50 or later to any later 1.xx version== <!--T:11-->
#[https://www.limesurvey.org/about-limesurvey/download Download] the desired version of LimeSurvey.
*[https://www.limesurvey.org/about-limesurvey/download Download] the desired version of LimeSurvey
# Prepare and backup the old installation.
* Backup your files and database ([[Upgrading from a previous version#Before you start...|did we already mention that?]]).
## Backup your installation directory files and SQL-based database just in case.
* Replace all the installation directory files
### At the command-line level, make a '''.zip''' or similar archive of the whole installation directory tree of files. For example, in Linux 'tar cvzf foo.tgz cps100' will tar and zip the whole of the cps100 directory;
** Delete all old files in the existing installation directory
### Using [httsp://www.phpmyadmin.net phpMyAdmin] or similar to export all tables; or using the '''LimeSurvey Administration''' button [[File:button-export-sql.png]] to backup the entire database.
** Upload and unpack the new code version into the same installation directory
## Copy your '''config.php''' file, modified '''template''' directories, and the /upload directory separately for quick access later;
** Edit or replace the '''config.php''' file:
# Replace all the installation directory files:
*** If your previous version was < 1.70: Edit the new '''config.php''' in order to reflect the changes from the backup '''config.php''' file. '''Do not just overwrite the new '''config.php''' with your old one!'''
## Delete all old files in the existing installation directory;
*** If your previous version was >= 1.70: Simply replace the new '''config.php''' with your backup '''config.php''' file (as the file format has not changed)
## Upload and unpack the new code version into the same installation directory;
** If your previous version was older than 1.90: Copy any customized templates to /upload/templates - you will also need to rename each template directory whose name matches an existing template in /templates
## Edit or replace the '''config.php''' file:
** Copy your /upload directory back to the old location
### If your previous version was < 1.70: Edit the new '''config.php''' in order to reflect the changes from the backup '''config.php''' file. '''Do not just overwrite the new '''config.php''' with your old one!''';
** Double-check the '''permissions''' set on the directories of LimeSurvey (write access to '''/tmp''', '''/upload''', and to their subdirectories is required) as described in the [[Installation#Set Directory permissions|installation wiki]]
### If your previous version was >= 1.70: Simply replace the new '''config.php''' with your backup '''config.php''' file (as the file format has not changed);
* Finish the installation/upgrade process
## If your previous version was older than 1.90: Copy any customized templates to '/upload/templates' - you will also need to rename each template directory whose name matches an existing template in /templates;
** Once you open the URL to your LimeSurvey administration, the database tables will be updated after confirmation
## Copy your '/upload' directory back to the old location;
** Remove or rename the /admin/install directory as/if instructed by the installation script
## Double check the '''permissions''' set on the directories of LimeSurvey (write access to '''/tmp''', '''/upload''', and to their subdirectories is required) as described in the [[Installation#Set Directory permissions|installation wiki]];
** Check if any special manual checks apply (as listed below)
# Finish the installation/upgrade process:
## Once you open the URL to your LimeSurvey administration, the database tables will be updated after confirmation;
## Remove or rename the '/admin/install' directory as/if instructed by the installation script;
## Check if any special manual checks apply (as listed below).


<!--T:12-->
<!--T:12-->
<div class="simplebox">'''Special checks after an upgrade''':
<div class="simplebox">'''Special checks after an upgrade''':
*'''from any earlier version to 1.92''': The '''templates''' have been changed. Please check your customized templates if they are still looking right. If not, you will have to edit your templates accordingly (check out the original templates to see what was changed)<br />
*'''From a version earlier than v1.53''': When upgrading from a version before v1.53 to the latest version, please check the '''global user rights''' of each user. There was a new '''superadmin''' right introduced in v1.53 that can give a user the same privilege as the master administration account created during the install. The upgrade script is guessing to whom this permission should be given in the older versions.  As this is not perfect, it should be carefully checked.
*'''from a version earlier than v1.53''': When upgrading from a version before v1.53 to the latest version, please check the '''global user rights''' of each user. There was a new '''superadmin''' right introduced in v1.53 that can give a user the same privilege as the master administration account created during the install. The upgrade script is guessing to whom should be given this permission in the older versions.  As this is not perfect, it should be carefully checked.
</div>
</div>


Line 91: Line 84:


<!--T:14-->
<!--T:14-->
Since the data structure and a lot of other things were changed, '''upgrading from any version previous to v1.50 is <u>NOT</u> possible'''. If you have old survey structure files with a *.sql extension, the only way to get these into a newer version is to install [http://www.limesurvey.org/en/archived-releases/289-limesurvey150zip version 1.50], import the .sql file(s) there, then upgrade that version to the most recent LimeSurvey version. Check the page related to [[Transferring an installation|how an installation can be transferred]] for more details.
Since the data structure and a lot of other things were changed, '''upgrading from any version previous to v1.50 is <u>NOT</u> possible'''. If you have old survey structure files with an *.sql extension, the only way to get these into a newer version is to install [http://www.limesurvey.org/en/archived-releases/289-limesurvey150zip version 1.50], import the .sql file(s) there, then upgrade that version to the most recent LimeSurvey version. Check the page related to [[Transferring an installation|how an installation can be transferred]] for more details.


=FAQ= <!--T:15-->
= Upgrading using CLI = <!--T:25-->
 
<!--T:26-->
You can upgrade the database via the PHP CLI: <code>php application/commands/console.php updatedb</code>. This allows you to set up an auto-upgrade system via command line (for example, in a crontab), although it is not recommended.
 
= Failed database upgrade after manual update/ComfortUpdate= <!--T:29-->
Sometimes, even though you did everything correct, things don't work out they are supposed to during database upgrade.
That may happen because of various reasons: Different database versions, unexpected data formats or contents, unusual configurations or anything else that did not show up in our tests (yes, we test a lot!)
 
<!--T:30-->
If you have an error during database update and your LimeSurvey instance ends up in an unusable state, you want to go back to the previous version.
This assumes that you still have the database and file backup, either from your regular backup or the one created by Comfortupdate.
 
<!--T:31-->
Please execute the following steps:
 
<!--T:32-->
*Backup the existing LimeSurvey directory and database (yes, again - we will call this the 2nd backup)
*Restore files to the existing directory (just overwriting them is fine) from the original (1st) backup.
*Delete the old database and restore the database from the original (1st) backup.
 
<!--T:33-->
That's it. Everything should be back to normal.
 
<!--T:34-->
'''A note about reporting this issue:'''
 
<!--T:35-->
If you run into a problem like this, please always report this in our bug tracker at https://bugs.limesurvey.org


==What is the most recent LimeSurvey version that still supports PHP4?== <!--T:16-->
<!--T:36-->
A bug not reported is a bug not fixed. Please don't just rely on other people reporting it. If you see that the bug is already reported, you can also help to raise the bug priority by marking it as 'Yes, this bug affects me' in the bug tracker.


<!--T:17-->
=FAQ= <!--T:15-->
The last release offering PHP4 support was version 1.82+.


==Can I upgrade even if I have active surveys?== <!--T:18-->
==Can I upgrade even if I have active surveys?== <!--T:18-->
Line 105: Line 126:
Yes, you can. Exceptions may be mentioned in the thorough instructions above. We strongly advise to test your surveys after upgrade to check if your design templates still work alright.
Yes, you can. Exceptions may be mentioned in the thorough instructions above. We strongly advise to test your surveys after upgrade to check if your design templates still work alright.


==What is best way to port the *.sql survey structure files of LimeSurvey to the latest version?== <!--T:20-->
==How to convert *.sql/*.csv survey structure files to the latest LimeSurvey version?== <!--T:20-->


<!--T:21-->
<!--T:21-->
Install version 1.50, import the file, and export the survey structure to the newer .csv format. The latest version can still read the .csv survey structure format.
Install version 1.50, import the file, and export the survey structure to the newer .csv format. Then install the latest Version 2.x and import the .csv format and export it to the current .lss format.
</translate>
</translate>
==Survey theme incompatibility==
With certain major version updates any custom survey themes will not be compatible, anymore:
* Update from LimeSurvey 2.6 or lower to LimeSurvey 2.50
* Update from LimeSurvey 5.x or lower to LimeSurvey 6.x
==Error "Multiple primary key defined" when updating MySQL database==
If you encounter this error, please check the setting ''sql_generate_invisible_primary_key'' in your MySQL server variables. This is most likely set to ''ON'', but should be set to ''OFF''. Then restore your database from the backup (as explained above) and try again.

Latest revision as of 10:51, 3 April 2024

Additional pages:{toc}

Before you start...

... read this because it is very important: Always backup the files and the database of your current installation!

You can do this using a database administration tool like phpMyAdmin and a file manager! If you don't know how to do this, you should not proceed further and ask someone who knows.

Recommendation to use ComfortUpdate

The easiest/safest way to upgrade is to use our ComfortUpdate service.

Upgrade instructions (from 2.x or newer to any later version)

Please follow these instructions:

  • Backup your files and database (did we already mention that?).
  • Delete all the old files/folders except for:
    • /application/config/security.php -Important!! This is the key to all encrypted data in LimeSurvey (version 4 and later)
    • /application/config/config.php;
    • /upload directory
Note: If you have any customized templates in /upload/templates, make sure you 'refresh' those with any changes that come with the new LimeSurvey version. The easiest way to check for such changes is to file-compare your old template with the new version of the default template. If you see any differences other than your customizations, a refresh is needed.
  • Copy the new files from the new LimeSurvey package to the existing location.
  • Open the admin page in your browser (e.g. https://www.example.com/limesurvey/admin) and check if a database scheme upgrade is necessary.
  • After the upgrade: Clear your browser cache and cookies!

Instructions for older versions

Unfortunately, there are a couple of things to consider, so please read the following instructions carefully.

Upgrading from version 1.50 or later to any later 2.xx version

  • Download the latest version of LimeSurvey
  • Backup your files and database (did we already mention that?).
  • Replace all the installation directory files
    • Delete all old files in the existing installation directory
    • Upload and unpack the new files of the new version into the same installation directory
    • If your previous version is older than 1.90, copy any customized templates to /upload/templates - you will also need to rename each template directory whose name matches an existing template in /templates
    • Copy your /upload directory back to the old location
    • Double-check the permissions set on the directories (write access to /tmp, /upload, and their subdirectories is required) as described in the installation wiki
    • Open http://<yourdomain>/<yourlimesurveydir>/admin in your browser and follow the instructions (You will find the database data in the old config.php). The existing database will be automatically detected and if necessary, upgraded after confirmation.
  • Check if any special manual checks apply as listed below
  • Now, clear your browser cache and cookies and you are good to go
  Attention : Please note that the template structure has changed with the update from 2.0x to 2.50 or later. Your old templates will not be working anymore as the template system is now using responsive templates.


Special checks after an upgrade:
  • from any earlier version to 2.xx: Proper question codes are mandatory now. After upgrading the installation, check the survey logic of all surveys and correct the codes where necessary
  • from a version earlier than v1.53: When upgrading from a version before v1.53 to the latest version, please check the global user rights of each user. There was a new superadmin right introduced in v1.53 that can give a user the same privilege as the master administration account created during the installation. The upgrade script is guessing to whom this permission should be given in the older versions. As this is not perfect, it should be carefully checked.
  • from any earlier version to v2.06: From 2.05 to 2.06, some unused permissions when editing global permissions for 'surveys' were activated. For example, if a user had only the 'create' permission in 2.05, the other permissions located to the right of 'create' would also get activated with the update to 2.06 (View/read, Update, Delete, Import, Export). Please check whether the admin users got any other global permissions besides the 'original' ones after the update. If yes, please edit them accordingly.

Upgrading from version 1.50 or later to any later 1.xx version

  • Download the desired version of LimeSurvey
  • Backup your files and database (did we already mention that?).
  • Replace all the installation directory files
    • Delete all old files in the existing installation directory
    • Upload and unpack the new code version into the same installation directory
    • Edit or replace the config.php file:
      • If your previous version was < 1.70: Edit the new config.php in order to reflect the changes from the backup config.php file. Do not just overwrite the new config.php with your old one!
      • If your previous version was >= 1.70: Simply replace the new config.php with your backup config.php file (as the file format has not changed)
    • If your previous version was older than 1.90: Copy any customized templates to /upload/templates - you will also need to rename each template directory whose name matches an existing template in /templates
    • Copy your /upload directory back to the old location
    • Double-check the permissions set on the directories of LimeSurvey (write access to /tmp, /upload, and to their subdirectories is required) as described in the installation wiki
  • Finish the installation/upgrade process
    • Once you open the URL to your LimeSurvey administration, the database tables will be updated after confirmation
    • Remove or rename the /admin/install directory as/if instructed by the installation script
    • Check if any special manual checks apply (as listed below)
Special checks after an upgrade:
  • From a version earlier than v1.53: When upgrading from a version before v1.53 to the latest version, please check the global user rights of each user. There was a new superadmin right introduced in v1.53 that can give a user the same privilege as the master administration account created during the install. The upgrade script is guessing to whom this permission should be given in the older versions. As this is not perfect, it should be carefully checked.

Upgrading from a version earlier than v1.50 (v1.0 through v1.44)

Since the data structure and a lot of other things were changed, upgrading from any version previous to v1.50 is NOT possible. If you have old survey structure files with an *.sql extension, the only way to get these into a newer version is to install version 1.50, import the .sql file(s) there, then upgrade that version to the most recent LimeSurvey version. Check the page related to how an installation can be transferred for more details.

Upgrading using CLI

You can upgrade the database via the PHP CLI: php application/commands/console.php updatedb. This allows you to set up an auto-upgrade system via command line (for example, in a crontab), although it is not recommended.

Failed database upgrade after manual update/ComfortUpdate

Sometimes, even though you did everything correct, things don't work out they are supposed to during database upgrade. That may happen because of various reasons: Different database versions, unexpected data formats or contents, unusual configurations or anything else that did not show up in our tests (yes, we test a lot!)

If you have an error during database update and your LimeSurvey instance ends up in an unusable state, you want to go back to the previous version. This assumes that you still have the database and file backup, either from your regular backup or the one created by Comfortupdate.

Please execute the following steps:

  • Backup the existing LimeSurvey directory and database (yes, again - we will call this the 2nd backup)
  • Restore files to the existing directory (just overwriting them is fine) from the original (1st) backup.
  • Delete the old database and restore the database from the original (1st) backup.

That's it. Everything should be back to normal.

A note about reporting this issue:

If you run into a problem like this, please always report this in our bug tracker at https://bugs.limesurvey.org

A bug not reported is a bug not fixed. Please don't just rely on other people reporting it. If you see that the bug is already reported, you can also help to raise the bug priority by marking it as 'Yes, this bug affects me' in the bug tracker.

FAQ

Can I upgrade even if I have active surveys?

Yes, you can. Exceptions may be mentioned in the thorough instructions above. We strongly advise to test your surveys after upgrade to check if your design templates still work alright.

How to convert *.sql/*.csv survey structure files to the latest LimeSurvey version?

Install version 1.50, import the file, and export the survey structure to the newer .csv format. Then install the latest Version 2.x and import the .csv format and export it to the current .lss format.

Survey theme incompatibility

With certain major version updates any custom survey themes will not be compatible, anymore:

  • Update from LimeSurvey 2.6 or lower to LimeSurvey 2.50
  • Update from LimeSurvey 5.x or lower to LimeSurvey 6.x

Error "Multiple primary key defined" when updating MySQL database

If you encounter this error, please check the setting sql_generate_invisible_primary_key in your MySQL server variables. This is most likely set to ON, but should be set to OFF. Then restore your database from the backup (as explained above) and try again.