• Get In Touch
November 15, 2016

Install and Configure PhpWiki on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Introduction

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.

Requirements

  • 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

Output:

    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

##Installing PhpWiki

First, download the latest stable version of PhpWiki from here

You can also download it using the wget command:

wget http://liquidtelecom.dl.sourceforge.net/project/phpwiki/PhpWiki%201.5%20%28current%29/phpwiki-1.5.5.zip

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:

cd /var/www/html/

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 mysql_secure_installation script.

    sudo mysql_secure_installation

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!

    Cleaning up...

    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:

cd /var/www/html/phpwiki/schemas

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 phpwiki.conf:

sudo nano /etc/apache2/sites-available/phpwiki.conf

Add the following lines:


ServerAdmin admin@yourdomain.com 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 /var/www/html/phpwiki/config/ directory:

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.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]