How to Install ProcessWire on FreeBSD 13

Updated on February 25, 2022
How to Install ProcessWire on FreeBSD 13 header image

Introduction

ProcessWire is a free and open-source Content Management System (CMS) used for building websites. It has a simple, intuitive user interface, powerful tools, scalable API, support for multi-language, and security, among other features. This article explains how to install ProcessWire on FreeBSD 13.0 server.

Prerequisites

Perform the following steps first:

Step 1. Install Packages

Update the system package list.

$ pkg update

Install required packages.

$ pkg install -y sudo nano unzip wget bash

Install PHP 7.4, Apache, MySQL, and more modules.

$ sudo pkg install -y apache24 mysql80-server mod_php74 php74 php74-session php74-curl php74-xml php74-zip php74-mbstring php74-ctype php74-imap php74-simplexml php74-tokenizer php74-xmlreader php74-xmlwriter php74-pear php74-fileinfo php74-json php74-phar php74-exif php74-iconv php74-mysqli php74-pdo_mysql php74-dom php74-filter php74-intl php74-openssl php74-intl php74-opcache php74-gd

Enable PHP-FPM service.

$ sudo sysrc php_fpm_enable=yes

Start PHP-FPM service.

$ sudo service php-fpm start

Copy the sample PHP configuration file.

$ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Step 2. Install ProcessWire

Download the latest version of the installation files from the official GitHub repository.

$ sudo wget https://github.com/processwire/processwire/archive/master.zip

Extract the ProcessWire installation package.

$ sudo unzip master.zip

Rename the extracted directory.

$ sudo mv processwire-master processwire

Move the renamed directory to the web root directory.

$ sudo mv processwire /usr/local/www/apache24/data/

Clean up the downloaded package.

$ sudo rm master.zip

Set the ownership of the directory to the web-root user and group.

$ sudo chown -R www:www /usr/local/www/apache24/data/processwire

Change the access permissions.

$ sudo chmod -R 755 /usr/local/www/apache24/data/processwire

Step 3. Create ProcessWire Database

Enable MySQL service to start on system boot.

$ sudo sysrc mysql_enable="yes"

Start MySQL service.

$ sudo service mysql-server start

Log in to MySQL shell. At the password prompt, just press Enter to continue.

$ sudo mysql -u root -p

Secure the MySQL root user by changing the password. Change the value of StrongPassword with your own secure password.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'StrongPassword';

Create a database named processwire.

CREATE DATABASE processwire;

Create a database user processwireuser with a password MySecurePassword. Change the value of MySecurePassword to your own secure password.

CREATE USER 'processwireuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MySecurePassword';

Grant the database user full access to the database.

GRANT ALL ON processwire.* TO 'processwireuser'@'localhost' WITH GRANT OPTION;

Save all the changes to take effect.

FLUSH PRIVILEGES;

Exit MySQL shell.

exit;

Step 4. Configure Apache2

Enable Apache service to start on system boot.

$ sudo sysrc apache24_enable=yes

Start Apache service.

$ sudo service apache24 start

Create a configuration file to allow Apache to work with PHP.

$ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf

Add the following lines of code to the file. Save and close the file.

<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>

Create Apache configuration file processwire.conf.

$ sudo nano /usr/local/etc/apache24/Includes/processwire.conf

Add the below code to the file. Save and close the file.

<VirtualHost *:80>

    ServerAdmin admin@example.com
    DocumentRoot /usr/local/www/apache24/data/processwire
    ServerName example.com

    <Directory /usr/local/www/apache24/data/processwire/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Test the configuration.

$ sudo apachectl configtest

Enable mod_rewrite by editing the apache configuration file.

$ sudo nano /usr/local/etc/apache24/httpd.conf

Uncomment the following line. Save and close the file:

LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Restart Apache service.

$ sudo service apache24 restart

Step 5. Access ProcessWire

To access the ProcessWire Web Interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.10/

Conclusion

You have installed ProcessWire on your FreeBSD 13.0 server. You can now check the official documentation to learn more on how to use ProcessWire.