Enable apacheHttpd mod_php in flakes

I’m trying to start an apache server within the development mode which is able to serve php files.
I was able to install and start the apache server in the development environment, but there is no mod_php package in /nix/store/…-apache-httpd-2.4.58/modules/.

This is what I have been trying so far:

{
  description = "Apache Server";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs,flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
		pkgs = import nixpkgs {
			inherit system;
			config = {
				services.httpd.enablePHP = true;
			};
		};
		apache = pkgs.apacheHttpd;
		php = pkgs.php83.override { apacheHttpd = pkgs.apacheHttpd.dev; };
		# php = pkgs.php83.override { apacheHttpd = apache; };
      in
      {
        devShells.default = pkgs.mkShellNoCC {
          packages = [ php apache ];
        };
      }
    );
}

In https://github.com/NixOS/nixpkgs/blob/a21f5e24e84b191b452d7e47cb9c275b46ed01c3/nixos/modules/services/web-servers/apache-httpd/default.nix it seems to my that config.service.httpd.enablePHP has to be true.
Is that correct?
Is there a way to enable mod_php?

2 Likes

Why would you need mod_php ?

To execute php scripts. I already got this to work with nginx+php-fpm and I am aware that i could use apache + php-fpm, but in this instance I would really like to get apache + mod_php working.