I faced a similar problem. After installing php 8.0 on Win 32 OS and Apache 2.4. I tried to link php to apache by adding the php module to httpd.conf file of apache. I added the code below to httpd config file.
# PHP8 module
PHPIniDir "C:/PHP"
AddType application/x-httpd-php .php
LoadModule php8_module C:/PHP/php8apache2_4.dll**
After which I tried to restart apache and got an error message in the Apache log error file. Apache refused to start and kept displaying and error message too.
httpd.exe: Syntax error on line 519 of C:/Program Files/Apache Software Foundation/Apache2.4/conf/httpd.conf: Cannot load C:/Program Files/Apache Software Foundation/Apache2.4/modules/php7apache2_4.dll into server: %1 is not a valid Win32 application.
I fixed the error by doing the following. It appears in Apache 2.4 httpd configuration file, php8_module has to be replaced with simply php_module without
any number. The code below fixed the error and apache started successfully after modifying the C:\Program Files\Apache Software Foundation\Apache2.4\conf\mime.types file.
# PHP 8.0
PHPIniDir "c:/php"
LoadModule php_module "c:/php/php8apache2_4.dll"
Add the following line to the end of the mime.types config file
application/x-httpd-php php