Operating System BSD

How to Install CMS Made Simple 2.2 on FreeBSD 15 with Apache, MariaDB and PHP

Install CMS Made Simple 2.2 on a FreeBSD 15 server with Apache 2.4, MariaDB and PHP 8.3, from packages to the installation assistant and pretty URLs.

This guide installs CMS Made Simple (CMSMS) 2.2 on a FreeBSD server with Apache 2.4, MariaDB and PHP, the stack usually called FAMP. It is written for FreeBSD 15.1, the current production release, and applies unchanged to the 14.5 legacy release. FreeBSD 11 is long out of support and has no package repository any more. At the end you will have a working site with its admin console, search-friendly URLs and sensible file permissions.

The CMSMS 2.2 series is still maintained: version 2.2.24 was released on 8 September 2026. The project's requirements page sets PHP 7.4 as the minimum and recommends PHP 8.3, so this guide uses the PHP 8.3 packages rather than FreeBSD's default PHP version.

Requirements

  • A FreeBSD 15.1 or 14.5 server with root access over SSH. The commands below are run as root; prefix them with sudo or doas if you use one of those.
  • A domain name such as example.com pointing to the server.

Bring the package catalogue and installed packages up to date first:

pkg update
pkg upgrade

Install Apache, MariaDB and PHP

CMSMS needs the PHP phar extension for its installation assistant, working sessions, and the json, tokenizer, xml and gd extensions; curl is recommended. JSON support is compiled into the base PHP package on FreeBSD. The list below adds the MySQL driver and a few extensions commonly used by modules:

pkg install apache24 mariadb118-server mariadb118-client \
  php83 mod_php83 php83-phar php83-session php83-tokenizer php83-xml \
  php83-gd php83-mysqli php83-curl php83-zlib php83-zip php83-mbstring \
  php83-ctype php83-dom php83-simplexml php83-fileinfo php83-opcache

Create a PHP configuration file from the production template:

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

CMSMS recommends an execution time limit of at least 60 seconds and upload and POST sizes of 10 MB or more. Open /usr/local/etc/php.ini and set:

max_execution_time = 60
post_max_size = 16M
upload_max_filesize = 16M
date.timezone = UTC

Use your own time zone identifier in place of UTC if you prefer. The production default for memory_limit is already well above the 24 MB that CMSMS recommends.

Create the database

Enable and start MariaDB, then run the hardening script:

sysrc mysql_enable=YES
service mysql-server start
mariadb-secure-installation

Open the MariaDB shell as root:

mariadb -u root

Create a database and a dedicated user. The installation assistant expects the user to have all privileges on that database. Choose your own strong password:

CREATE DATABASE cmsms CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'cmsms'@'localhost' IDENTIFIED BY 'change-this-password';
GRANT ALL PRIVILEGES ON cmsms.* TO 'cmsms'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download the installation assistant

CMSMS is installed by a single self-extracting PHP file, the installation assistant. It is distributed inside a small zip archive on the project's download page. Check that page for the current version and adjust the file name; for 2.2.24 the commands are:

mkdir -p /usr/local/www/cmsms
cd /tmp
fetch https://s3.amazonaws.com/cmsms-forge/downloads/15484/cmsms-2.2.24-install.zip
unzip cmsms-2.2.24-install.zip -d /usr/local/www/cmsms

The archive contains cmsms-2.2.24-install.php and a README. The assistant unpacks the CMS into the directory it sits in, so the web server user (www on FreeBSD) must own that directory:

chown -R www:www /usr/local/www/cmsms

Configure Apache

Pretty URLs depend on mod_rewrite, which is disabled in FreeBSD's default configuration. Open /usr/local/etc/apache24/httpd.conf and remove the leading # from this line:

LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Files ending in .conf in /usr/local/etc/apache24/Includes/ are loaded automatically. Create /usr/local/etc/apache24/Includes/php.conf so that Apache passes PHP files to mod_php:

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

Then create /usr/local/etc/apache24/Includes/cmsms.conf for the site. AllowOverride All lets the .htaccess file you add later take effect:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/usr/local/www/cmsms"
    <Directory "/usr/local/www/cmsms">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Check the syntax, enable Apache at boot and start it:

service apache24 configtest
sysrc apache24_enable=YES
service apache24 start

Run the installation assistant

Browse to http://example.com/cmsms-2.2.24-install.php. A blank page instead of the welcome screen means a PHP error; add ?debug=1 to the address or look in /var/log/httpd-error.log. The assistant then takes you through these steps:

  1. Choose a language. Advanced Mode is optional and only adds more settings and more detailed output.
  2. The assistant looks for an existing installation and, finding none, offers a new install.
  3. Compatibility tests. A failed required test names the missing PHP extension or setting; fix it, restart Apache and retry.
  4. Database: host localhost, database cmsms, user cmsms and its password, plus the server time zone.
  5. The first administrator account. Use a real email address; the login details are sent there.
  6. Site name and any additional languages.
  7. Files are copied, the database tables are created (with sample content by default) and config.php is written.

The last screen links to the site and to the admin console at http://example.com/admin.

Clean up and tighten permissions

Remove the assistant and its README, and make the configuration file read-only. It contains the database password and does not need to change during normal operation:

rm /usr/local/www/cmsms/cmsms-2.2.24-install.php /usr/local/www/cmsms/README*.txt
chmod 444 /usr/local/www/cmsms/config.php

Enable pretty URLs

By default page addresses look like index.php?page=about. CMSMS ships a ready-made rewrite file in its doc folder. Copy it into place as .htaccess:

cp /usr/local/www/cmsms/doc/htaccess.txt /usr/local/www/cmsms/.htaccess
chown www:www /usr/local/www/cmsms/.htaccess

Then tell CMSMS to generate rewritten links by adding one line to the bottom of config.php. Make the file writable for the edit and read-only again afterwards:

chmod 644 /usr/local/www/cmsms/config.php
echo "\$config['url_rewriting'] = 'mod_rewrite';" >> /usr/local/www/cmsms/config.php
chmod 444 /usr/local/www/cmsms/config.php

Reload a page on the site and confirm that menu links no longer contain index.php?page=. In the admin console, clear the cache under Site Admin → System Maintenance if old links persist.

Maintain the site

  • Add HTTPS before real users log in, for example with a Let's Encrypt certificate and Apache's mod_ssl.
  • Keep the stack patched with pkg upgrade.
  • To upgrade CMSMS, download the installation assistant of the new version into the site directory and open it in the browser. It detects the existing installation and offers an upgrade. Back up the database and files first.
  • The project also suggests renaming the admin directory and recording the new name in config.php with $config['admin_dir']; rename it back before running an upgrade.

The official requirements and installation assistant pages document every option.

Frequently asked questions

Can I use FreeBSD's default PHP instead of 8.3?

FreeBSD's default PHP is currently 8.5. The CMSMS requirements page lists 8.3 as both the recommended version and the newest one tested by the development team, and warns that older third-party modules may need 8.1 or even 7.4. Core may run on newer PHP, but staying on 8.3 avoids surprises with modules.

Does CMSMS work with Nginx?

Yes. The project lists Apache, Nginx and Lighttpd as supported web servers. With Nginx you run PHP through PHP-FPM and translate the rewrite rules from htaccess.txt into the server configuration, because .htaccess files are not read.

The assistant says it cannot write files. What is wrong?

The directory that holds the -install.php file is not writable by the www user, or the temporary directory is not usable. Re-run the chown command above; if the problem is the temporary directory, the assistant accepts a TMPDIR=/absolute/path parameter in the URL pointing to a writable location.

Should I disable ModSecurity?

The requirements page says mod_security must be disabled for CMSMS. It is not part of the Apache package installed here, so this only matters if you add it later.

Share story:

Continue reading other guides on How VPS.