Installing Simplified Saaze on Windows 10
This blog uses the static site generator Simplified Saaze. I use this generator on Arch Linux. The Linux environment is a very natural environment for such a generator. In case you want to use this generator on Windows, this post shows the steps to install it on Windows.
There are multiple ways to install Simplified Saaze on Windows. The main part is to install PHP on Windows.
- Install PHP by compiling from source using Visual C
- Install PHP by using git-bash
- Install PHP by using WSL
Here we describe the route via WSL (Windows Subsystem for Linux) and using Ubuntu version 22.04. Version 22.04 is the long-term-support release ("LTS"). I think this is the easiest approach.
1. Installing Ubuntu. Windows Subsystem for Linux is started by entering
wsl. If Ubuntu does not already start, then the next two paragraphs may help. Otherwise install Ubuntu from the so called "Windows App Store".
On Windows make sure, whether "Windows Subsystem for Linux" is checked.
See Fix: WSLRegisterDistribution Failed with Error 0x8007019e if your WSL is not properly set-up. Choose Ubuntu 22.04 in the Microsoft App Store.
Once WSL and Ubuntu is up and running, then install the following packages with
- gcc: for md4c
- libmd4c-html0-dev: MD4C lib
- libmd4c-dev: MD4C header file
- php-yaml, alternatively to this package you can install below:
Not strictly required for Simplified Saaze, but handy to have for web-development:
- ripgrep: recursive grep
- webp: to reduce image size
- nano: for those who do not feel comfortabe with
2. PHP extensions. Now install the PHP Yaml plugin as described here PECL's Yaml Way Faster Than Symfony's Yaml. In WSL it seems to be important to build this PECL within the filesystem of WSL, not on anything on
/mnt/c, etc. On Ubuntu the
yaml.so file is moved to
Activate FFI in
php.ini. Edit file
/etc/php/8.1/cli/conf.d/20-ffi.ini and add below line:
3. Apache web-server. Start web-server:
service apache2 start
Go to any Windows browser, e.g., Firefox, and check
/var/www/html/phpinfo.php with content:
<?php phpinfo(); ?>
Then check with any browser whether
http://localhost/phpinfo.php shows something like this:
I would recommend to add your user to group
/etc/group. This eases later deployment to
/var/www/html. This directory should be
4. Installing example project. Now install example project.
klm@ITEM-S78314:~$ composer create-project eklausme/saaze-example Creating a "eklausme/saaze-example" project at "./saaze-example" Info from https://repo.packagist.org: #StandWithUkraine Installing eklausme/saaze-example (v1.0) - Downloading eklausme/saaze-example (v1.0) - Installing eklausme/saaze-example (v1.0): Extracting archive Created project in /home/klm/saaze-example Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals - Locking eklausme/saaze (v1.19) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Downloading eklausme/saaze (v1.19) - Installing eklausme/saaze (v1.19): Extracting archive Generating optimized autoload files
vendor/eklausme/saaze and compile:
cc -fPIC -Wall -O2 -shared php_md4c_toHtml.c -o php_md4c_toHtml.so -lmd4c-html
sudo mkdir -p /srv/http, then move the generated lib to
/srv/http. Although any other place will do as well, as long as you configure this in
Finally run a build:
time php saaze
This should produce a directory called
klm@ITEM-S78314:~/saaze-example$ time php saaze Building static site in /home/klm/saaze-example/build... execute(): filePath=/home/klm/saaze-example/content/blog.yml, nentries=35, totalPages=2, entries_per_page=20 execute(): filePath=/home/klm/saaze-example/content/music.yml, nentries=11, totalPages=1, entries_per_page=20 Finished creating 2 collections, 2 with index, and 46 entries (0.18 secs / 913kB) #collections=2, YamlParser=0.0085/48-2, md2html=0.0008, MathParser=0.0002/46, renderEntry=46, content=46/0, excerpt=0/0 real 0m0.741s user 0m0.016s sys 0m0.156s
5. Dynamic mode. As mentioned in Simplified Saaze, there is also a dynamic mode in Simplified Saaze. For this start
php -S 0:8000 -t ./public &
Start any browser on Windows. You should see something like this: