How to install PhpWiki on a CentOS 7 VPS
PhpWiki is a wiki-based content management software written in PHP, used to create web sites where anyone can edit or create the pages using a web browser.
In this tutorial we will show you the steps needed to install PhpWiki on a CentOS 7 VPS
At the time of writing this tutorial, the latest stable version of PhpWiki is 1.5.3 and it requires:
- PHP 5.3.29 or higher, compiled with support for the type of database you want to use and with the PEAR libraries enabled;
- Apache Web Server 2.0 or higher compiled with mod_rewrite module;
- MySQL, MariaDB, PostgreSQL or SQLite.
This install guide assumes that Apache, MySQL (or MariaDB) and PHP are already installed and configured on your virtual server. If your server has a minimal CentOS 7 base installation, you can install Apache, MariaDB and PHP stack by following this tutorial.
Download the latest version of PhpWiki available at ‘http://downloads.sourceforge.net/project/phpwiki/’ to the server and extract it using the following commands:
cd /opt/ wget http://downloads.sourceforge.net/project/phpwiki/phpwiki-1.5.3.zip unzip phpwiki-1.5.3.zip -d /var/www/html/ cd /var/www/html/ mv phpwiki-1.5.3 phpwiki
Create a new MySQL database for PhpWiki on your server:
mysql -u root -p MariaDB > create database phpwikidb; MariaDB > grant all privileges on phpwikidb.* to [email protected] identified by 'your-password'; MariaDB > > flush privileges; MariaDB > quit;
Create tables inside your phpwikidb database:
cd /var/www/html/phpwiki/schemas mysql -uphpwikiuser -pyour-password phpwikidb < mysql-initialize.sql
Create a new virtual host directive in Apache. For example, edit your Apache configuration file (‘/etc/httpd/conf/httpd.conf’ by default) and un-comment the following line:
Then, add the following lines at the end:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/phpwiki/ ServerName yourdomain.com ServerAlias www.yourdomain.com <Directory /var/www/html/phpwiki/> DirectoryIndex index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog logs/yourdomain.com-error_log CustomLog logs/yourdomain.com-access_log common </VirtualHost>
Restart the Apache service for the changes to take effect:
systemctl restart httpd.service
Create a subdirectory called ‘data’ in the ‘phpwiki’ directory:
mkdir -p /var/www/html/data/
Copy ‘/var/www/html/config/config-dist.ini’ to ‘/var/www/html/phpwiki/config/config.ini’ and edit the settings in ‘/var/www/html/phpwiki/config/config.ini’ file according to your needs. It may be simpler for you to use http://phpwiki.fr/configurator.php to generate the ‘config.ini’ configuration file for PhpWiki:
- enter the name of your website, administrator username and password
- make sure you select to use encrypted passwords to be stored in the ‘config.ini’ file and the users homepages metadata
- set the path to access log file (e.g. /var/log/httpd/yourdomain.com-access_log)
- set ‘COMPRESS_OUTPUT’ to true (Always try to compress output)
- set ‘HTTP Cache Control’ to ‘LOOSE’ so cached pages will be invalidated whenever they are edited
- select the database backend type to SQL
- SQL Type (MySQL), SQL User (phpwikiuser) and its password, SQL Database Name (phpwikidb)
- set ‘Allow anonymous edit’ and ‘Allow Bogo Login’ to false
- set ‘PASSWORD_LENGTH_MINIMUM’ to at least 8 characters
- edit part four: ‘Page appearance and layout’ according to your liking and finally click on the ‘Save config/config.ini’ button.
Copy the generated configuration to a file, and save it as ‘/var/www/html/phpwiki/config/config.ini’. Set the proper ownership of PhpWiki files and directories using the following command:
chown apache:apache -R /var/www/html/phpwiki/
That is it. The PhpWiki installation is now complete.
Open http://yourdomain.com in your favorite browser and once the initialization complete, open http://yourdomain.com/index.php/PhpWikiAdministration and log in using your Administrator login credentials.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install PhpWiki for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.