Apache, php82, Apache out error

FreeBSD 13, Apache24, PHP82-8.2.0.r2, mod_php82-8.2.0.r2_1

service apache24 onestart

Apache out error.

httpd: Syntax error on the line 108 of httpd.conf:
Can't locate API module structure php_module in the
/usr/local/libexec/apache24/libphp.so: undefined symbol "php_module"

In line 108 httpd.conf:
LoadModule php_module libexec/apache24/libphp.so

How to resolve problem???
On a machine with PHP 8.2 and mod_php82 installed (and working):
% pkg info | grep mod_php
mod_php82-8.2.0                PHP Scripting Language (8.2.X branch)
In /usr/local/etc/apache24/httpd.conf I have these lines:
 LoadModule php_module         libexec/apache24/libphp.so
<IfModule php_module>
    AddType application/x-httpd-php .php
I reinstall apache, php 82, mod_php.
Same error (Screenshort in attachment).


  • httpd.conf.configphp.gif
    36.1 KB · Views: 97
  • httpd.conf.loadmodule.gif
    36.8 KB · Views: 80
  • pkginfoapache.gif
    4.2 KB · Views: 89
  • httpdtryrun.gif
    9.9 KB · Views: 87
You seem to have added the php FilesMatch sethandler code block inside another module block <IfModule mime_module>?. Try setting it outside of that block.

A fresh install of apache24, php82 and mod_php82 here works fine. A very minimal httpd.conf that works is below, I've just removed the comments and only listed enabled modules.

Note that the latest versions of mod_php82 and php82 are newer than yours, so try updating.
# pkg info | grep php
mod_php82-8.2.4    PHP Scripting Language (8.2.X branch)
php82-8.2.4    PHP Scripting Language (8.2.X branch)

Apache config:
ServerRoot "/usr/local"
Listen 80
LoadModule mpm_prefork_module libexec/apache24/mod_mpm_prefork.so
LoadModule authn_file_module libexec/apache24/mod_authn_file.so
LoadModule authn_core_module libexec/apache24/mod_authn_core.so
LoadModule authz_host_module libexec/apache24/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache24/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache24/mod_authz_user.so
LoadModule authz_core_module libexec/apache24/mod_authz_core.so
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
LoadModule auth_basic_module libexec/apache24/mod_auth_basic.so
LoadModule reqtimeout_module libexec/apache24/mod_reqtimeout.so
LoadModule filter_module libexec/apache24/mod_filter.so
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule log_config_module libexec/apache24/mod_log_config.so
LoadModule env_module libexec/apache24/mod_env.so
LoadModule headers_module libexec/apache24/mod_headers.so
LoadModule setenvif_module libexec/apache24/mod_setenvif.so
LoadModule version_module libexec/apache24/mod_version.so
LoadModule unixd_module libexec/apache24/mod_unixd.so
LoadModule status_module libexec/apache24/mod_status.so
LoadModule autoindex_module libexec/apache24/mod_autoindex.so
LoadModule dir_module libexec/apache24/mod_dir.so
LoadModule alias_module libexec/apache24/mod_alias.so
LoadModule php_module libexec/apache24/libphp.so
# Third party modules
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf
<IfModule unixd_module>
User www
Group www
ServerAdmin you@example.com
<Directory />
    AllowOverride none
    Require all denied
DocumentRoot "/usr/local/www/apache24/data"
<Directory "/usr/local/www/apache24/data">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
<IfModule dir_module>
    DirectoryIndex index.html
<Files ".ht*">
    Require all denied
ErrorLog "/var/log/httpd-error.log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    CustomLog "/var/log/httpd-access.log" common
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/www/apache24/cgi-bin/"
<Directory "/usr/local/www/apache24/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
<IfModule headers_module>
    RequestHeader unset Proxy early
<IfModule mime_module>
    TypesConfig etc/apache24/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
Include etc/apache24/Includes/*.conf

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source