, 3 min read

Installing Simplified Saaze on Windows 10 #2

Original post is here eklausmeier.goip.de/blog/2023/01-31-installing-simplified-saaze-on-windows-10-p2.


This post provides an alternative installation route to the one described in Installing Simplified Saaze on Windows. The installation described there was using Windows Subsystem for Linux and installing Ubuntu. Some company policies might prevent this approach.

The approach described here is a Windows-only approach.

1. Downloading software. Download PHP 8.1 from PHP For Windows. The reason for 8.1 is that the yaml-extension only is available for 8.1 at the moment. Unpack the zip-file and place everything unter C:\php.

Download the yaml-extension. Place the file php_yaml.dll in C:\php\ext.

Download Composer-Setup.exe from the PHP Composer website. Run the program. Choose "For me only". It should find the PHP executable in C:\php\php.exe.

Download Tiny C compiler from Fabrice Bellard: the zip-file in question is tcc-0.9.27-win64-bin.zip. Unpack the zip-file at the place of your liking.

2. Configuring PHP. Copy C:\php\php.ini-development to C:\php\php.ini. Edit the latter:

  1. Uncomment extension=ffi
  2. Add extension=yaml
  3. Set ffi.enable=true at the end of the file

Start new DOS cmd shell. Then run php -m. This should show that extensions FFI and yaml are activated.

3. Compiling MD4 FFI module. Place C file md4c.c to where you installed the Tiny C compiler, and compile:

tcc -shared -rdynamic md4c.c

This should produce md4c.dll and md4c.def. Only the DLL is relevant. Copy the DLL file to C:\php\ext. You can place it anywhere. It is not a PHP extension, but placing it there is not a totally bad idea.

md4c.c is an amalgamation of my FFI and the actual MD4C.

4. Installing example project. Now install example project. For this open a DOS cmd shell.

C:\User\elmar: 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

Go to vendor/eklausme/saaze and change Config.php and edit the line with global_ffi:

Old New
"/srv/http/php_md4c_toHtml.so" "C:/php/ext/md4c.dll"

Finally run a build:

php saaze

This should produce a directory called build.

C:\User\elmar\saaze-example: php saaze
Building static site in ...
    execute(): filePath=(...)/saaze-example/content/blog.yml, nentries=35, totalPages=2, entries_per_page=20
    execute(): filePath=(...)/saaze-example/content/music.yml, nentries=11, totalPages=1, entries_per_page=20
Finished creating 2 collections, 2 with index, and 46 entries

5. Dynamic mode. As mentioned in Simplified Saaze, there is also a dynamic mode in Simplified Saaze. For this start

php -S 0.0.0.0:8000 -t public

Start any browser on Windows. You should see something like this: