Installing Question2Answer with single sign-on
Question2Answer is designed to integrate with websites which have an existing user database and management system. If your site is running WordPress 3.x, you should follow the instructions for WordPress integration. To implement single sign-on for other sites, a small amount of PHP programming is required. Please follow the instructions below:
-
Download the latest version of Question2Answer to your computer or web server (also available on GitHub).
-
Unzip the download using a tool such as WinZip (or
unzipin the Unix shell). -
Set up a MySQL database and user for Question2Answer:
- If your website already uses a MySQL database, Question2Answer can share it. Simply ensure that the MySQL user you use has at least these privileges: CREATE, ALTER, DELETE, INSERT, SELECT, UPDATE, LOCK TABLES.
- Otherwise, create a new MySQL database and a MySQL user with the privileges: CREATE, ALTER, DELETE, INSERT, SELECT, UPDATE, LOCK TABLES.
-
Find
qa-config-example.phpand.htaccess-examplein the unzippedquestion2answerfolder, and rename them toqa-config.phpand.htaccess, respectively. -
Open
qa-config.phpin the text editor you use for PHP programming. Insert the MySQL details at the top, then scroll down and setQA_EXTERNAL_USERStotrue, then save the file. -
Find the
qa-external-examplesubfolder in the unzippedquestion2answerfolder, and rename it toqa-external. -
In the
qa-external-users.phpfile in theqa-externalfolder, modify theqa_get_mysql_user_column_type()function to return the appropriate MySQL column type for your user identifiers. For example, if you use textual identifiers, return[VARCHAR(x)](http://dev.mysql.com/doc/mysql/en/char.html), wherexis the maximum length. If you use numerical identifiers, return the appropriate numeric type, such asINT UNSIGNEDorBIGINT. Ensure you get this right because it will be used in many of Question2Answer's MySQL tables. -
Place all the contents of the
question2answerfolder (including .htaccess and your changes) in the appropriate location on your web server. -
Open the web page corresponding to this location in your web browser.
-
Follow the on-screen instructions to set up your database with single sign-on integration.
-
Now go back to
qa-external-users.phpand read it through in full. You will need to modify several functions in order to complete the single sign-on integration. Everything is explained in this file, and lots of examples are included.
