Loading...
 

History: How to install WikiSuite on Windows Server

Preview of version: 112 (current)

The reference implementation of WikiSuite is with Linux as per How to install WikiSuite. However, in some corporate environments, the only option is Microsoft Windows Server. Thus, in 2018, we developed an alternate recipe to set up parts of WikiSuite on Windows Server 2012 R2 (and we also did some testing on Windows Server 2016). This was for Tiki18.x, using SVN.

The client-project for which this was done later moved to Linux, so the recipe below has not continued to be maintained.

If you need this, please contact Marc Laporte for professional services via his company: EvoluData.





The reference implementation of WikiSuite is with ClearOS. However, in some corporate environments, the only option is Windows Server. Thus, we are currently developing an alternate recipe to set up parts of WikiSuite on Windows Server 2012 R2 (and we are currently testing on Windows Server 2016)

Included

Use Windows version instead of Linux

  • PHP 5.6 or PHP 7.1 (Tiki 18.x)
  • Apache 2.4
  • MariaDB

Replaced

  • ClearOS OpenLDAP -> Use Tiki logins as master (So Openfire needs to connect to Tiki instead of ClearOS's OpenLDAP)
  • Cron jobs -> Windows Tasks (make sure console.php index:rebuild --log is run from where the Tiki is)
  • svn from the command line -> https://tortoisesvn.net/
  • ClearOS firewall -> Windows Firewall
  • https://doc.tiki.org/Search-within-files -> ???

Maybe later

Excluded


Installation instructions

For the instructions below, please use the Command Prompt (which is different than Windows PowerShell)

  • It is recommended to activate these two options:
    • Show "File name extension" as it makes it easier to create a new .php file
    • Show "Hidden items" as Subversion (the tool used to manage source control of Tiki) uses this to store needed data. And thus, if you move Tiki to a new directory, you need to make sure not to forget these hidden folders.

2016 08 20 Windows 2012 Show Hide File Name Extensions And Hidden Items

Install the following with an account with administrative rights

  • Download and install TortoiseSVN
  • Download TortoiseSVN - v1.9.7 as of 2017/09/09;
  • Double-click on the '.msi' file to run the setup;
  • Click on the 'Next >' button;
  • Click on the 'Next >' button again;
  • Select 'Will be installed on local hard drive' for the 'command line client tools' feature;
  • Click on the 'Next >' button;
  • Click on the 'Install' button;
  • Click on the 'Finish' button.

Download and install latest Apache

  • Unzip and move the 'Apache24' directory to the root of your data drive (example: 'D:');
  • Unzip 'mod_fcgid.so' to "D:\Apache24\modules\";
  • Run "D:\Apache24\bin\httpd.exe" from a command prompt;
    • If you choose to run 'D:', you'll get some error messages and be instructed to fix some lines in 'httpd.conf'. Just replace the paths from 'C:' to 'D:'.
  • By navigating to 'http://127.0.0.1/', confirm that "It works!";
  • With focus on the command prompt window hold down "Ctrl + C" then release both to stop Apache.

Download and install latest PHP 5 or 7.1

  • Download PHP VC11 x64 Thread Safe - v5.6.31 or 7.1.10 as of 2017/10/02;
  • Extract the content of this file to the root of your data drive in 'a 'PHP5' or PHP7 directory (example: 'D:\PHP5');
  • Add 'php.exe' to the system's path environmental variable:

From the Command Prompt (Admin)
C:\>setx PATH "%PATH%;D:\PHP5" /M

SUCCESS: Specified value was saved.

C:\>exit

Configure PHP

  • Navigate to the PHP folder and copy the 'php.ini-production' file to 'php.ini';
  • Edit the 'php.ini' file;
  • Find the 'extension_dir' directive and change so that it properly locates the 'ext' folder, i.e.:

; extension_dir = "ext"
>>>
extension_dir = D:\PHP5\ext

  • Uncomment the Windows Extensions for MySQL / MariaDB by removing the ";":

;extension=php_mysqli.dll
>>>
extension=php_mysqli.dll

;extension=php_pdo_mysql.dll
>>>
extension=php_pdo_mysql.dll

  • Uncomment the 'curl' and 'openssl' Windows extensions to be able to use Composer:

;extension=php_curl.dll
>>>
extension=php_curl.dll

;extension=php_openssl.dll
>>>
extension=php_openssl.dll

  • Uncomment the 'gd2' Windows extensions to be able to correctly use Tiki:

;extension=php_gd2.dll
>>>
extension=php_gd2.dll

  • Uncomment the 'mbstring', 'gmp' and 'gettext' Windows extensions as recommended by Tiki Check

;extension=php_mbstring
;extension=php_gettext.dll
;extension=php_gmp.dll
>>>
extension=php_mbstring.dll
extension=php_gettext.dll
extension=php_gmp.dll

  • Uncomment the PATH_INFO/PATH_TRANSLATED support for CGI:

;cgi.fix_pathinfo=1
>>>
cgi.fix_pathinfo=1

  • Save the file as 'php.ini'.
  • Ensure that you can run PHP from the Windows Command Line:

php -m

If you get "the program can't start because msvcr110.dll is missing", it's likely because you picked the 32 bits ( x86) version instead of 64 above.

  • Edit the PHP configuration file ('php.ini') for Tiki's usage:

memory_limit = 128M
>>>
memory_limit = 256M

upload_max_filesize = 2M
>>>
upload_max_filesize = 128M

post_max_size = 8M
>>>
post_max_size = 128M

;extension=php_pdo_sqlite.dll
;extension=php_sqlite3.dll
>>>
extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll

;extension=php_fileinfo.dll
>>>
extension=php_fileinfo.dll

;extension=php_intl.dll
>>>
extension=php_intl.dll

disable_functions = 
>>>
disable_functions = exec, passthru, shell_exec, system, proc_open, popen, curl_exec, curl_multi_exec, parse_ini_file, show_source, allow_url_fopen

  • Edit the PHP configuration file ('php.ini') to add your timezone as recommended by Tiki :
  • Here's a configuration example for 'date.timezone':

;date.timezone =
>>>
date.timezone = America/New_York

  • Configure the 'session.save_path' in 'php.ini' in order to use PHP's session functions:

;session.save_path = "/tmp"
>>>
session.save_path = "C:\Windows\Temp"

  • Edit the PHP configuration file ('php.ini') to enable OPcache for performance:

+++
zend_extension=php_opcache.dll

;opcache.enable=0
>>>
opcache.enable=1

;opcache.memory_consumption=64
>>>
opcache.memory_consumption=128

;opcache.interned_strings_buffer=4
>>>
opcache.interned_strings_buffer=8

;opcache.max_accelerated_files=2000
>>>
opcache.max_accelerated_files=4000

;opcache.revalidate_freq=2
>>>
opcache.revalidate_freq=60

;opcache.fast_shutdown=0
>>>
opcache.fast_shutdown=1

  • Edit the PHP configuration file ('php.ini') to enable OPcache for performance for CLI and FastCGI (PHP7):

;opcache.enable_cli=0
>>>
opcache.enable_cli=1


  • Edit the PHP configuration file ('php.ini') to display errors (optional)

+++
display_errors=Off
>>>
display_errors=On

  • Edit the PHP configuration file ('php.ini') to enable LDAP support

+++
;extension=php_ldap.dll
>>>
extension=php_ldap.dll

  • Edit the Apache configuration file ('httpd.conf') to make sure you load 'mod_fcgid':

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>
   FcgidMaxProcesses 300
   FcgidMaxProcessesPerClass 300

   FcgidOutputBufferSize 65536
   FcgidConnectTimeout 10
   FcgidProcessLifeTime 0
   FcgidMaxRequestsPerProcess 0
   FcgidMinProcessesPerClass 0
   FcgidFixPathinfo 0
   FcgidProcessLifeTime 0
   FcgidZombieScanInterval 20
   FcgidMaxRequestLen 536870912
   FcgidIOTimeout 120
   FcgidTimeScore 3

   FcgidPassHeader Authorization

   FcgidInitialEnv PHPRC "D:\\PHP5"
   FcgidInitialEnv PATH "D:\\PHP5;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
   FcgidInitialEnv SystemRoot "C:\\Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv windir "C:\\WINDOWS"
   <Files ~ "\.php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "D:/PHP5/php-cgi.exe" .php
   </Files>
</IfModule>

  • Finally, add 'index.php' to the "DirectoryIndex" directive in 'httpd.conf' to serve that file:

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
>>>
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

  • Run "D:\Apache24\bin\httpd.exe" from a command prompt; If you receive no error, open a command prompt using 'Run as administrator' then navigate to the 'bin' folder of Apache to run Apache as a service. Now, install the service:

D:\Apache24\bin>httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.

D:\Apache24\bin>net start Apache2.4
The Apache2.4 service is starting.
The Apache2.4 service was started successfully.


D:\Apache24\bin>

  • After that, the service will be automatically restarted every time the server is rebooted.

Download and install latest MariaDB

  • Download the current stable release of MariaDB - v10.2.8 as of 2017/09/09;
    • Download the "ZIP file" package type for Windows x86_64;
  • Click the 'No thanks, just take me to the download' button if you don't want to be added to their mailing list;
  • Extract the content of this file to the root of your data drive and rename the directory to 'MariaDB';
  • If upgrading, keep a copy of the data directory and copy it back. Then after starting mysql, do: mysql_upgrade -uroot -p See Upgrading from MariaDB 10.1 to MariaDB 10.2

D:\MariaDB>copy my-large.ini my.ini
        1 file(s) copied.

D:\MariaDB>

  • Edit the default MariaDB configuration file ('my.ini') to change socket location:

[client]
socket		= /tmp/mysql.sock
>>>
socket		= C:\Windows\Temp\mysql.sock

[mysqld]
socket		= /tmp/mysql.sock
>>>
socket		= C:\Windows\Temp\mysql.sock

  • Edit the MariaDB configuration file ('my.ini') for Tiki's usage:

max_allowed_packet = 1M
>>>
max_allowed_packet = 128M

+++
character_set_server = utf8

  • Install 'mysqld.exe' as a Windows service using the following:

From the Command Prompt (Admin)
D:\MariaDB\bin>mysqld.exe --install
Service successfully installed.

D:\MariaDB\bin>net start MySQL
The MySQL service is starting...
The MySQL service was started successfully.


D:\MariaDB\bin>

  • After that, the service will be automatically restarted every time the server is rebooted;
  • Assign a password to the root user because by default no password is set:

D:\MariaDB\bin>mysql.exe -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.14-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_password');
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SET PASSWORD FOR 'root'@'::1' = PASSWORD('new_password');
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

D:\MariaDB\bin>

Set the path

From the Command Prompt (Admin)
C:\>setx PATH "%PATH%;D:\MariaDB\bin" /M

SUCCESS: Specified value was saved.

C:\>exit

Create a new directory that will be used as "DocumentRoot"

  • Open a command prompt and navigate to 'D:\';
  • Create a 'www' directory that will be used by Apache as "DocumentRoot":

D:\>md www

D:\>

  • Edit the Apache configuration file in 'D:\Apache24\conf\httpd.conf') to enable 'mod_rewrite' and change "DocumentRoot" + "AllowOverride All":

#LoadModule rewrite_module modules/mod_rewrite.so
>>>
LoadModule rewrite_module modules/mod_rewrite.so

DocumentRoot "d:/Apache24/htdocs"
<Directory "d:/Apache24/htdocs">
(...)
    AllowOverride None
>>>
DocumentRoot "d:/www"
<Directory "d:/www">
(...)
    AllowOverride All

  • Restart Apache:

C:\>net stop Apache2.4
The Apache2.4 service is stopping.....
The Apache2.4 service was stopped successfully.


C:\>net start Apache2.4
The Apache2.4 service is starting.
The Apache2.4 service was started successfully.


C:\>

Download and install Adminer

  • Download Adminer - v4.3.1 as of 2017/09/09;
  • Copy the downloaded file to "D:\www\" and rename it to 'adminer.php';
  • NOTE: Adminer will be used later in this documentation.
  • When you are finished, make sure to delete "D:\www\adminer.php".


Configure TortoiseSVN

  • Add 'svn.exe' to the system's path environmental variable:

From the Command Prompt (Admin)
C:\>setx PATH "%PATH%;C:\Program Files\TortoiseSVN\bin" /M

SUCCESS: Specified value was saved.

C:\>exit


Vis the TortoiseGUI, you can also configure a proxy. This proxy will also work on the command line version,

Download and install Fake Sendmail (optional)


If you prefer to skip this step, just configure Tiki to use an external SMTP server.

  • Download Fake Sendmail;
  • Copy 'sendmail.exe' and 'sendmail.ini' from the archive into 'D:\usr\lib';
  • Edit 'D:\usr\lib\sendmail.ini' and enter your mail account credentials;
  • Edit 'D:\PHP5\php.ini' to configure the 'sendmail_path':

;sendmail_path =
>>>
sendmail_path = D:\usr\lib\sendmail -t -i

  • Restart Apache:

C:\>net stop Apache2.4
The Apache2.4 service is stopping.....
The Apache2.4 service was stopped successfully.


C:\>net start Apache2.4
The Apache2.4 service is starting.
The Apache2.4 service was started successfully.


C:\>

Download and install Tiki

  • Open a command prompt and navigate to 'D:\www';
  • Download the latest Tiki 17.x from SVN:

D:\www>svn checkout https://svn.code.sf.net/p/tikiwiki/code/branches/17.x .

  • Download Composer
  • Move the 'composer.phar' file to 'D:\www\temp';
  • Install the project dependencies:

cd \www\vendor_bundled
D:\www>php ..\temp\composer.phar install

  • Edit the 'php.ini' file;
allow_url_fopen = On
>>>
allow_url_fopen = Off

  • Create a user and database with same name for Tiki using Adminer:
  • Click on the 'Create new database' link;
  • Enter the desired database name and select 'utf8_unicode_ci' for the "collation";
  • Click on the 'Save' button;
  • Click on the 'Privileges' link;
  • Click on the 'Create user' link;
  • Enter the desired "User name" and "Password";
  • Check 'All privileges' and click on the 'Save' button.

  • Initiate the Tiki installation by loading the 'tiki-install.php' script:
  • Click on the 'Continue' button;
  • Click on the 'Continue' button again;
  • Click on the 'Continue' button one more time;
  • Under "Database information" enter the "Database name";
  • Under "Database user" enter the "User name" and its "Password";
  • Under "Database host" enter 127.0.0.1 instead of localhost to force IP address connection;
  • Click on the 'Continue' button;
  • Select 'InnoDB' for the database engine and click on the 'Install' button;
  • Click on the 'Continue' button.



The installer should either link from .htaccess to _htaccess or copy _htaccess to .htaccess. If this doesn't work, you can do manually:

copy _htaccess .htaccess

Download and install Elasticsearch

  • Download and install Java Runtime Envirronement 8
  • Double-click on the '.exe' file to run the setup;
  • Click on the 'Install >' button;
  • Click on the 'Next >' button;
  • Click on the 'Next >' button again;
  • Click on the 'Close' button;
  • Set the "JAVA_HOME" variable in Windows:

From the Command Prompt (Admin)
C:\>setx JAVA_HOME "C:\Program Files\Java\jre1.8.0_144" /M

SUCCESS: Specified value was saved.

C:\>exit

D:\Elasticsearch\bin>elasticsearch-service install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "C:\Program Files\Java\jdk1.8.0_144"
The service 'elasticsearch-service-x64' has been installed.

D:\Elasticsearch\bin>elasticsearch-service start
The service 'elasticsearch-service-x64' has been started

D:\Elasticsearch\bin>elasticsearch-service manager


Elasticsearch 2.3.3 Service x64

  • Change "Startup type" from 'Manual' to 'Automatic';
  • Click on the 'Apply' button;
  • Click on the 'OK' button.

Successfully started service manager for 'elasticsearch-service-x64'.

D:\Elasticsearch\bin>

Upgrading Elasticsearch

The procedure would be similar to downgrade. You probably want to upgrade your Java version as well.

Download new Elasticsearch version and unzip into a folder elasticsearch-new

Then, from the Command Prompt (Admin)

D:\>cd\Elasticsearch\bin

D:\Elasticsearch\bin>service stop
The service 'elasticsearch-service-x64' has been stopped

D:\Elasticsearch\bin> service remove
The service 'elasticsearch-service-x64' has been removed

D:\Elasticsearch\bin>cd\

D:\>ren Elasticsearch Elasticsearch-old

D:\>ren elasticsearch-new Elasticsearch

D:\>cd Elasticsearch\bin

D:\>Elasticsearch\bin>elasticsearch-service install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "C:\Program Files\Java\jdk1.8.0_91"
The service 'elasticsearch-service-x64' has been installed.

D:\Elasticsearch\bin>elasticsearch-service start
The service 'elasticsearch-service-x64' has been started

D:\Elasticsearch\bin>service manager

- Change "Startup type" from 'Manual' to 'Automatic';
- Click on the 'Apply' button;
- Click on the 'OK' button.

Successfully started service manager for 'elasticsearch-service-x64'.

D:\Elasticsearch\bin>

Then, rebuild Tiki index, via command line or web interface


cd \www
php console.php index:rebuild --log

http://127.0.0.1/tiki-admin.php?page=search

- Click on the 'Rebuild Index' button;
- Click on the 'Rebuild' button.

Configure Elasticsearch for use with Tiki

  • Click on the 'Rebuild Index' button;
  • Click on the 'Rebuild' button.

Schedule a task to Rebuild Search Index

  • Open a command prompt using 'Run as administrator' to schedule a daily task:

C:\>md D:\Scripts

C:\>echo pushd D:\www ^& php console.php index:rebuild --log > "D:\Scripts\Rebuild_Search_Index.bat

C:\>schtasks /create /ru SYSTEM /tn "Rebuild Search Index" /tr "D:\Scripts\Rebuild_Search_Index.bat" /sc daily /st 03:00
SUCCESS: The scheduled task "Rebuild Search Index" has successfully been created
.

C:\>


It is necessary to use a batch file to create a scheduled task with multiple actions.

Configure the Windows Firewall to allow access

  • Open TCP port 80 (HTTP) in Windows Firewall:

C:\>netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80
Ok.


C:\>

Performance issues

If you have performance issues (can be related to your specific environment), add the following in your httpd.conf file:

AcceptFilter http none
AcceptFilter https none
EnableMMAP off

Note about setx PATH

A few times in the instructions above, there is "From the Command Prompt (Admin)" -> C:\>setx PATH...
You need to exit after each, and thus open a new command prompt for each.

General note about these instructions

  • If you follow the instructions and things don't seem to happen like they should, try a reboot of Windows. Sometimes, this is necessary for some settings to work.

To discuss

  • Backup script: TRIM on Cygwin
  • Monitoring (especially of Elasticsearch)


History

Advanced
Information Version
eric.beaurivage 11
View
eric.beaurivage 10
View
Marc Laporte 9
View
Marc Laporte 8
View
Marc Laporte 7
View
Marc Laporte 6
View
Marc Laporte 5
View
Marc Laporte 4
View
Marc Laporte 3
View
Marc Laporte 2
View
Marc Laporte 1
View