Pages

Wednesday, March 19, 2014

Create your own Q&A system with phpMyFAQ

What is phpMyFAQ?


phpMyFAQ is a scalable open source FAQ software using PHP and available for many databases.

    --http://www.phpmyfaq.de/

phpMyFAQ sports a nice list of features like multiple database support, content management system user/group permissions and much more...
Check out the full list of features here

Introduction

  • This how-to is based on phpMyFAQ 2.8.8, CentOS 6.5 minimal install - fresh install, Apache 2.2.15, MySQL  5.1.73 and PHP 5.3.3.
  • In this how-to hostname will be sandbox1 and IP address will be 192.168.122.34 
  • Login as 'root' user and perform all below steps
  • This how-to is ideal for test/proof of concept environments, to deploy in production environments, please consider consulting phpMyFAQ professional team -> support@phpmyfaq.de

Install the pre-requisites

[root@sandbox1 ~]# yum -y install httpd mysql-server php php-gd php-xml php-mysqli


Prepare the server to install phpMyFAQ

Add the server's IP and host name to /etc/hosts:

[root@sandbox1 ~]# echo "10.128.122.34 sandbox1.lab.local sanbox1" 

http://www.mediawiki.org/wiki/Register_globals

Add ServerName entery to Apache config:

[root@sandbox1 ~]# echo "ServerName sandbox1:80" >> /etc/httpd/conf/httpd.conf

Start Apache and MySQL services:

[root@sandbox1 ~]# service httpd start
[root@sandbox1 ~]# service mysqld start

Set Apache and MySQL to start automatically when the server boots:

[root@sandbox1 ~]# chkconfig httpd on
[root@sandbox1 ~]# chkconfig mysqld on

 

Secure MySQL:

[root@sandbox1 ~]# mysql_secure_installation

Below is stripped-down output of mysql_secure_installation steps, follow the prompts as shown below.

We haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y
 ... Success!

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!


Login to MySQL as 'root'

[root@sandbox1 ~]# mysql -u root -p

This will prompt you for the password, please enter the MySQL root password we set earlier in "Secure MySQL" step.

Create a database for phpMyFAQ - faq_db 

mysql> create database faq_db;


Create a database user for phpMyFAQ - faq_user

mysql> user faq_db;

mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','faq_user',PASSWORD('Welcome123'));


mysql> INSERT INTO user (Host,User,Password) VALUES('127.0.0.1','faq_user',PASSWORD('Welcome123'));


Grant appropriate priviliges for faq_user on faq_db

mysql> grant CREATE, DROP, ALTER, INDEX, INSERT, UPDATE, DELETE, SELECT on faq_db to faq_user;

 

Exit MySQL

mysql> exit
Bye
[root@sandbox1 ~]#

Reduce maximum amount of memory a script may consume from the default 128 MB to 64 MB 

[root@sandbox1 ~]# sed -i 's/128M/64M/g' /etc/php.ini
 

Open port 80 to access phpMyFAQ

[root@sandbox1 ~]# iptables -I INPUT 4 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT



Install and configure phpMyFAQ

Download phpMyFAQ in a temporary folder

 [root@sandbox1 ~]# cd /var/tmp 
 [root@sandbox1 tmp]# curl -OL http://www.phpmyfaq.de/download/phpMyFAQ-2.8.8.tar.gz

Extract the compressed phpMyFAQ file to Apache's base folder 

[root@sandbox1 tmp]# tar xzf phpMyFAQ-2.8.8.tar.gz -C /var/www/html/

Rename the extracted folder for convenience

[root@sandbox1 tmp]# cd /var/www/html/
[root@sandbox1 html]# mv phpmyfaq faq

 

Create  directories for  attachments, data and images

[root@sandbox1 html]# cd /var/www/html/faq
[root@sandbox1 faq]# mkdir attachments data images


Change the ownership of 'faq' directory

[root@sandbox1 faq]# cd /var/www/html/
[root@sandbox1 html]# chown -R apache:apache faq

Now point your browser to the IP address of the host we installed phpMyFAQ - http://192.168.122.34 and you will see the page in below screen-shot. Fill in the details as shown below:

  1. Database server: Keep the default selection, not required to change anything.
  2. Database hostname: localhost
  3. Database user: faq_user
  4. Database password: enter the password for faq_user
  5. Database name: faq
  6. Table prefix: faq_
  7. Default language: Click on the drop down for more options and choose your preferred language.
  8. Permission level:  Select Medium (with group support) from the drop-down menu.
    phpMyFAQ also offers a flexible management of privileges (or rights) for different groups in the admin area. You can set permissions for groups in the same way like for users described in the topic above.
    Please note that the permissions for a group are higher rated than the permissions on a user. To enable the group permissions, please set the permission level from basic to medium in the main configuration.
  9. Your Name: This can be anything either your full name or something generic like "Administrator"
  10. Your email address: Enter an email address of your choice.
  11. Your login name: Enter a login name of your choice, this this will be used to login to phpMyFAQ with administrator rights.
  12. Your password: password for the account name you entered in step 11
  13. Retype password: type the same password again, which you typed in step 12
  14. Click on the button "Click to install phpMyFAQ 2.8.8"  to complete the installation.

Congratulations, setup is complete. Explore phpMyFAQ

You will be directed to the below page, it will be of help if you can do the survey and send the feedback. If not, you can click on the link "your version of phpMyFAQ" to see the landing page of your installation or click on the "admin section" link, login with the username/password you created in step 11 - 13 and explore the settings





No comments:

Post a Comment