We were discussing about building a questions and answers community using Question2Answer. In the previous part 1 of this series, we’ve just taught how to install Question2Answer via Softaculous. Well, it was simple yet an ordinary person would be able to understand quite easily. How about to install Question2Answer manually, I mean there is also a wide majority of people who don’t have access to use Softaculous in there cPanel account. So, I realized why not write an article installing Q2A manually, and this would be great if someone don’t have permissions to access Softaculous.
Installing Question2Answer Manually
First of all, we need to download the Q2A script from one of the following sites:
Once downloaded try exacting the script from .zip file and upload it into your cPanel account, either create a separate folder or make a subdomain for it. But here I’m uploading the extracted folder inside of a folder like (www.yoursite.com/question2answer). If you’ve uploaded the q2a script into your cPanel account, start navigating the url where you have just uploaded the script.
Oops, when your site loaded inside of browser, and here you can see a fatal error:
Question2Answer fatal error: The config file could not be found. Please read the instructions in qa-config-example.php.
Now, to solve this fatal error we just need to change the name of the file qa-config-example.php to qa-confiq.php which is located here: yoursite.com/question2answer.
The problem have been solved, and now all we need to do is to create a database connection for question2answer script. You can see another error which is mysql_connect() error, which means that the database information is incorrect inside of question2answer\qa-include\qa-db.php on line 66.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'your-mysql-username'@'localhost' (using password: YES) in C:\xampp\htdocs\question2answer\qa-include\qa-db.php on line 66
Now, what we gonna to is to create a database, assign a user and password for it, and locate that information into qa-config.php file.
Example of connecting the Database
First of all, create a database inside of PhpmyAdmin follow these steps:
1. Login in to cPanel > Databases
2. Create database inside of Mysql Databases like:
3. Scroll down a bit and Add new user
4. Once the user added, add that user into the database
We’ve created a database, a user and password. And now, all we need to do is to insert this information inside of qa-config.php file.
Replace this with the new information
====================================================================== THE 4 DEFINITIONS BELOW ARE REQUIRED AND MUST BE SET BEFORE USING! ====================================================================== */ define('QA_MYSQL_HOSTNAME', 'localhost'); // try '127.0.0.1' or 'localhost' if MySQL on same server define('QA_MYSQL_USERNAME', 'your-mysql-username'); // haroon define('QA_MYSQL_PASSWORD', 'your-mysql-password'); // ****** define('QA_MYSQL_DATABASE', 'your-mysql-db-name'); // q2a /*
Just replace your-mysql-username with your created one, same for password and database. Now, start navigating your site where the script is uploaded, once you see the welcome page then everything correct or if you didn’t see a welcome then try contacting us with the error you facing with.
After clicking the button and you will be proceeded to create your administrator login on the next page and once admin login created you’ll be able to use your own Questions and Answers community.