Installing Simplified Saaze on Windows 10 #2

· klm's blog


Original post is here: eklausmeier.goip.de

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:

1tcc -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.

 1C:\User\elmar: composer create-project eklausme/saaze-example
 2Creating a "eklausme/saaze-example" project at "./saaze-example"
 3Info from https://repo.packagist.org: #StandWithUkraine
 4Installing eklausme/saaze-example (v1.0)
 5  - Downloading eklausme/saaze-example (v1.0)
 6  - Installing eklausme/saaze-example (v1.0): Extracting archive
 7Created project in /home/klm/saaze-example
 8Loading composer repositories with package information
 9Updating dependencies
10Lock file operations: 1 install, 0 updates, 0 removals
11  - Locking eklausme/saaze (v1.19)
12Writing lock file
13Installing dependencies from lock file (including require-dev)
14Package operations: 1 install, 0 updates, 0 removals
15  - Downloading eklausme/saaze (v1.19)
16  - Installing eklausme/saaze (v1.19): Extracting archive
17Generating 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:

1php saaze

This should produce a directory called build.

1C:\User\elmar\saaze-example: php saaze
2Building static site in ...
3	execute(): filePath=(...)/saaze-example/content/blog.yml, nentries=35, totalPages=2, entries_per_page=20
4	execute(): filePath=(...)/saaze-example/content/music.yml, nentries=11, totalPages=1, entries_per_page=20
5Finished 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

1php -S 0.0.0.0:8000 -t public

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