PhpWiki is a web based wiki content management system written in PHP. You can easily create and edit pages through web browser using PhpWiki. In this tutorial, we will show you how to install and configure PhpWiki on Ubuntu 16.04.
- A server running Ubuntu-16.04.
- A non-root user with sudo privileges setup on your server.
Update the System
First, you will need to update the system with latest version. You can do this with the following commands:
sudo apt-get update -y
sudo apt-get upgrade -y
##Installing LAMP Server
Before starting, you will need to install the LAMP stack as a prerequisites of PhpWiki. You can install LAMP using the following command:
sudo apt-get install apache2 libapache2-mod-php7.0 mariadb-server php7.0 php7.0-mysql
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libc-ares2 libcitadel4 libev4 libical1a libsieve2-1 Use 'sudo apt autoremove' to remove them. Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear The following NEW packages will be installed: apache2 libapache2-mod-php7.0 mariadb-server php7.0 php7.0-mysql 0 upgraded, 5 newly installed, 0 to remove and 60 not upgraded. Need to get 0 B/1,450 kB of archives. After this operation, 5,351 kB of additional disk space will be used. Selecting previously unselected package apache2.......
Once installation is completed, start the Apache service and enable rewrite module:
sudo systemctl start apache2
sudo a2enmod rewrite
First, download the latest stable version of PhpWiki from here
You can also download it using the wget command:
Next, unzip the downloaded archive in to /var/www/html directory:
sudo unzip phpwiki-1.5.5.zip -d /var/www/html/
Next, change the directory to /var/www/html and rename phpwiki-1.5.5:
sudo mv phpwiki-1.5.5 phpwiki
Next, set the proper permissions for the phpwiki directory:
sudo chown -R www-data:www-data phpwiki
Configuring MariaDB For miniBB
By default, MariaDB is not secured, so you will need to secure it first. You can secure it with the
Answer all the questions as shown below:
``` NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you 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...
Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n ... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] Y ... Success!
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y ... Success!
By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success!
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n] Y ... Success!
All done! If you've completed all of the above steps, your MariaDB installation should now be secure.
Thanks for using MariaDB! ```
Next, login to MariaDB and create a database and database user for PhpWiki.
mysql -u root -p
Enter your MariaDB root password and hit enter. Once you are logged in to your database, create a database for PhpWiki:
MariaDB [(none)]> create database phpwikidb; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on phpwikidb.* to phpwikiuser@localhost identified by 'password'; Query OK, 0 rows affected (0.05 sec)
MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit; Bye
Next, create a table inside your phpwiki database:
mysql -uphpwikiuser -ppassword phpwikidb < mysql-initialize.sql
Configuring Apache for PhpWiki
Once the database is configured, you will need to create a new virtual host file
sudo nano /etc/apache2/sites-available/phpwiki.conf
Add the following lines:
ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/html/phpwiki ServerName Your-server-ip ServerAlias www.yourdomain.com
Options FollowSymLinks AllowOverride All Order allow,deny allow from all
ErrorLog /var/log/apache2/phpwiki-error_log CustomLog /var/log/apache2/phpwiki_custom_log common
Once you are finished, save the file and enable a virtual host by running the following command:
sudo a2ensite phpwiki.conf
sudo service apache2 reload
Next, you will need to create a
config.ini file inside
sudo nano /var/www/html/phpwiki/config/config.ini
Add the following lines as per your environment:
WIKI_NAME = phpWiki
#Username and password of administrator. ADMIN_USER = phpwikiadmin ADMIN_PASSWD = admin@123
#To use plain text passwords, in particular for the ADMIN_PASSWD, set ENCRYPTED_PASSWD to false. ENCRYPTED_PASSWD = false
#If set, reverse dns lookups will be performed to attempt to convert #the user's IP number into a host name, in the case where the http server does not do this. ENABLE_REVERSE_DNS = true
# If true, only the admin user can make zip dumps. Otherwise anyone # may download all wiki pages as a single zip archive. ZIPDUMP_AUTH = false
ENABLE_RAW_HTML = true
# If this is set, only pages locked by the Administrator may contain the # RawHtml plugin ENABLE_RAW_HTML_LOCKEDONLY = true
# If this is set, all unsafe html code is stripped automatically (experimental!) # See http://chxo.com/scripts/safe_html-test.php ENABLE_RAW_HTML_SAFE = true
# If true, only the admin user or users from localhost (without password) can do: INSECURE_ACTIONS_LOCALHOST_ONLY = true
CACHE_CONTROL = LOOSE CACHE_CONTROL_MAX_AGE = 600 COOKIE_EXPIRATION_DAYS = 365 DATABASE_TYPE = sql
DATABASE_DSN = "mysql://guest@unix(/var/lib/mysql/mysql.sock)/test"
DATABASE_PERSISTENT = false DATABASE_SESSION_TABLE = session DATABASE_DBA_HANDLER = db4 DATABASE_TIMEOUT = 12 MAJOR_MAX_AGE = 32 MAJOR_KEEP = 8 MINOR_MAX_AGE = 7 MINOR_KEEP = 4 AUTHOR_MAX_AGE = 365 AUTHOR_KEEP = 8 AUTHOR_MIN_AGE = 7 AUTHOR_MAX_KEEP = 20 ALLOW_ANON_EDIT = true ALLOW_BOGO_LOGIN = true ALLOW_USER_PASSWORDS = true USER_AUTH_POLICY = first-only GROUP_METHOD = WIKIPAGE DBAUTH_AUTH_CRYPT_METHOD = plain DEFAULT_LANGUAGE = en
Once you are finished, save and close the file.
Accessing PhpWiki Web Interface
Once everything is set up, it's time to access PhpWiki web interface.
Open your favorite browser and navigate to http://yourdomain.com or http://your-server-ip and complete the required the steps to finish the installation.