apache24 with mod_php82 won't start up.

Thanks !

Code:
cksum /usr/local/sbin/httpd
1728080431 596412 /usr/local/sbin/httpd

Code:
 pkg which /usr/local/sbin/httpd
/usr/local/sbin/httpd was installed by package apache24-2.4.54

Code:
pkg info apache24-2.4.54
apache24-2.4.54
Name           : apache24
Version        : 2.4.54
Installed on   : Sat Oct 22 14:44:51 2022 CEST
Origin         : www/apache24
Architecture   : FreeBSD:13:i386
Prefix         : /usr/local
Categories     : www
Licenses       : APACHE20
Maintainer     : [email]apache@FreeBSD.org[/email]
WWW            : [URL]https://httpd.apache.org/[/URL]
Comment        : Version 2.4.x of Apache web server
Options        :
        ACCESS_COMPAT  : on
        ACTIONS        : on
        ALIAS          : on
        ALLOWMETHODS   : on
        ASIS           : on
        AUTHNZ_FCGI    : on
        AUTHNZ_LDAP    : off
        AUTHN_ANON     : on
        AUTHN_CORE     : on
        AUTHN_DBD      : on
        AUTHN_DBM      : on
        AUTHN_FILE     : on
        AUTHN_SOCACHE  : on
        AUTHZ_CORE     : on
        AUTHZ_DBD      : on
        AUTHZ_DBM      : on
        AUTHZ_GROUPFILE: on
        AUTHZ_HOST     : on
        AUTHZ_OWNER    : on
        AUTHZ_USER     : on
        AUTH_BASIC     : on
        AUTH_DIGEST    : on
        AUTH_FORM      : on
        AUTOINDEX      : on
        BROTLI         : off
        BUCKETEER      : off
        BUFFER         : on
        CACHE          : on
        CACHE_DISK     : on
        CACHE_SOCACHE  : on
        CASE_FILTER    : off
        CASE_FILTER_IN : off
        CERN_META      : on
        CGI            : on
        CGID           : on
        CHARSET_LITE   : on
        DATA           : on
        DAV            : on
        DAV_FS         : on
        DAV_LOCK       : on
        DBD            : on
        DEFLATE        : on
        DIALUP         : on
        DIR            : on
        DOCS           : on
        DUMPIO         : on
        ECHO           : off
        ENV            : on
        EXAMPLE_HOOKS  : off
        EXAMPLE_IPC    : off
        EXPIRES        : on
        EXT_FILTER     : on
        FILE_CACHE     : on
        FILTER         : on
        HEADERS        : on
        HEARTBEAT      : on
        HEARTMONITOR   : on
        HTTP2          : on
        IDENT          : off
        IMAGEMAP       : on
        INCLUDE        : on
        INFO           : on
        IPV4_MAPPED    : off
        LBMETHOD_BYBUSYNESS: on
        LBMETHOD_BYREQUESTS: on
        LBMETHOD_BYTRAFFIC: on
        LBMETHOD_HEARTBEAT: on
        LDAP           : off
        LOGIO          : on
        LOG_DEBUG      : on
        LOG_FORENSIC   : on
        LUA            : off
        LUAJIT         : off
        MACRO          : on
        MD             : on
        MIME           : on
        MIME_MAGIC     : on
        MPM_EVENT      : off
        MPM_PREFORK    : on
        MPM_SHARED     : on
        MPM_WORKER     : off
        NEGOTIATION    : on
        OPTIONAL_FN_EXPORT: off
        OPTIONAL_FN_IMPORT: off
        OPTIONAL_HOOK_EXPORT: off
        OPTIONAL_HOOK_IMPORT: off
        PROXY          : on
        PROXY_AJP      : on
        PROXY_BALANCER : on
        PROXY_CONNECT  : on
        PROXY_EXPRESS  : on
        PROXY_FCGI     : on
        PROXY_FDPASS   : on
        PROXY_FTP      : on
        PROXY_HCHECK   : on
        PROXY_HTML     : on
        PROXY_HTTP     : on
        PROXY_HTTP2    : on
        PROXY_SCGI     : on
        PROXY_UWSGI    : on
        PROXY_WSTUNNEL : on
        RATELIMIT      : on
        REFLECTOR      : on
        REMOTEIP       : on
        REQTIMEOUT     : on
        REQUEST        : on
        REWRITE        : on
        SED            : on
        SESSION        : on
        SESSION_COOKIE : on
        SESSION_CRYPTO : on
        SESSION_DBD    : on
        SETENVIF       : on
        SLOTMEM_PLAIN  : on
        SLOTMEM_SHM    : on
        SOCACHE_DBM    : on
        SOCACHE_DC     : off
        SOCACHE_MEMCACHE: on
        SOCACHE_REDIS  : off
        SOCACHE_SHMCB  : on
        SPELING        : on
        SSL            : on
        STATUS         : on
        SUBSTITUTE     : on
        SUEXEC         : off
        SUEXEC_SYSLOG  : off
        UNIQUE_ID      : on
        USERDIR        : on
        USERTRACK      : on
        VERSION        : on
        VHOST_ALIAS    : on
        WATCHDOG       : on
        XML2ENC        : on
Shared Libs required:
        libxml2.so.2
        libpcre2-8.so.0
        libnghttp2.so.14
        libjansson.so.4
        libgdbm.so.6
        libexpat.so.1
        libdb-5.3.so.0
        libcurl.so.4
        libaprutil-1.so.0
        libapr-1.so.0
Annotations    :
        FreeBSD_version: 1301000
        cpe            : cpe:2.3:a:apache:http_server:2.4.54:::::freebsd13:x86
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 26.8MiB
Description    :
The Apache HTTP Server Project is an effort to develop and maintain an
open-source HTTP server for various modern desktop and server operating
systems, such as UNIX and Windows NT. The goal of this project is to
provide a secure, efficient and extensible server which provides HTTP
services in sync with the current HTTP standards.
The 2.x branch of Apache Web Server includes several improvements like
threading, use of APR, native IPv6 and SSL support, and many more.

WWW: https://httpd.apache.org/
 
Mhm, so you are on i386 system? Don't have i386 machine at hand, need to set that up.

Can you tell me how to make this verification ? (make sure you don't have conflict with the modules)
Yes, the -M switch is a good way. Also you can check your config you are not loading php and php7 at the same time. I actually did quick debug when OP asked this question and the crash that is happening when both php and php7 are loaded is due to this. It seems these modules are stepping into each other.

But if you have only one module loaded something else is happening. Interestingly enough I can't even check 32b dump with 64b gdb (and there's no such thing as gdb-multiarch on FreeBSD).
 
Mhm, so you are on i386 system ?

Yes I am, and OP is under I386 as well.

It is an old machine... Inter Core2 Duo. It can handle a 64bits, but I never took the time to re install it... It was working very good for my little needs... for 10 years now... Upgrades always working perfectly. First time I have a problem.

I confirm that i dont have multiple version of php. The previous version of PHP before the upgrade was 7.4.30.

Code:
php --version
PHP 7.4.32 (cli) (built: Oct  2 2022 01:19:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.32, Copyright (c), by Zend Technologies

Code:
locate php | grep bin | grep -ve ports -ve www
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/bin/php-config
/usr/local/bin/phpize
/usr/local/include/php/ext/apc/apc_bin.h
/usr/local/sbin/php-fpm

Code:
pkg info | grep ^php
php74-7.4.32                   PHP Scripting Language
php74-bcmath-7.4.32            The bcmath shared extension for php
php74-bz2-7.4.32               The bz2 shared extension for php
php74-ctype-7.4.32             The ctype shared extension for php
php74-curl-7.4.32              The curl shared extension for php
php74-dom-7.4.32               The dom shared extension for php
php74-exif-7.4.32              The exif shared extension for php
php74-extensions-1.0           "meta-port" to install PHP extensions
php74-fileinfo-7.4.32          The fileinfo shared extension for php
php74-filter-7.4.32            The filter shared extension for php
php74-gd-7.4.32                The gd shared extension for php
php74-gmp-7.4.32               The gmp shared extension for php
php74-iconv-7.4.32             The iconv shared extension for php
php74-intl-7.4.32              The intl shared extension for php
php74-json-7.4.32              The json shared extension for php
php74-ldap-7.4.32              The ldap shared extension for php
php74-mbstring-7.4.32          The mbstring shared extension for php
php74-opcache-7.4.32           The opcache shared extension for php
php74-openssl-7.4.32           The openssl shared extension for php
php74-pcntl-7.4.32             The pcntl shared extension for php
php74-pdo-7.4.32               The pdo shared extension for php
php74-pdo_mysql-7.4.32         The pdo_mysql shared extension for php
php74-pdo_sqlite-7.4.32        The pdo_sqlite shared extension for php
php74-pecl-APCu-5.1.21         APC User Caching
php74-pecl-imagick-3.5.1       PHP wrapper to the ImageMagick/GraphicsMagick library version 6
php74-phar-7.4.32              The phar shared extension for php
php74-posix-7.4.32             The posix shared extension for php
php74-session-7.4.32           The session shared extension for php
php74-simplexml-7.4.32         The simplexml shared extension for php
php74-sqlite3-7.4.32           The sqlite3 shared extension for php
php74-tokenizer-7.4.32         The tokenizer shared extension for php
php74-xml-7.4.32               The xml shared extension for php
php74-xmlreader-7.4.32         The xmlreader shared extension for php
php74-xmlwriter-7.4.32         The xmlwriter shared extension for php
php74-xsl-7.4.32               The xsl shared extension for php
php74-zip-7.4.32_1             The zip shared extension for php
php74-zlib-7.4.32              The zlib shared extension for php
Alors have installed : nextcloud-php74-24.0.5

And for the modules :

Code:
httpd -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_prefork_module (shared)
 authn_file_module (shared)
 authn_core_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_core_module (shared)
 access_compat_module (shared)
 auth_basic_module (shared)
 reqtimeout_module (shared)
 filter_module (shared)
 mime_module (shared)
 log_config_module (shared)
 env_module (shared)
 headers_module (shared)
 setenvif_module (shared)
 version_module (shared)
 ssl_module (shared)
 unixd_module (shared)
 status_module (shared)
 autoindex_module (shared)
 dir_module (shared)
 alias_module (shared)
 php7_module (shared)
Thanks a lot to take some time for helping me.

And just for my knowledge... what is "gbd" ?

Vince
 
It's gdb(1) - very neat debugger. With that you can do either post-mortem analysis of a crash or even do a live debugging of a process.

I've installed i386 VM and I can reproduce the crash. Let me see if I can find something.

Good news ^^

It seems that I havent done something wrong. Thansk again for the help !
 
This is an interesting problem. Crash occurs within very first function apache calls from this module: create_php_config. But problem is not the source code itself (C code) but rather the assembly code. Long story short -- it fails to jump properly to memset (your core dump shows that too) because ebx register is bogus. But even if I manually set it to a proper value (which I can determine if I read the init part of module in assembly) it crashes elsewhere because other modules and even httpd core has problem with it. i386 architecture in general suffers from lack of generic purpose registers, maybe clang is doing something here which screw things up. Personally I've not seen this issue ever, such behavior among loaded libraries.

Having that in my mind I tried gcc11 and built the port this way:
Code:
pkg install gcc
cd /usr/ports/www/mod_php74/
export CC=/usr/local/bin/gcc
make install clean
And I was able to start apache properly.

Side note: I built apache, apr, mod_php74 from ports with debug symbols so I can navigate myself easier around the debugger. Funny enough apache24 won't build as is. I had to modify the source code of apache ; trivial modification of snprintf() because compiler flags were too strict (time_t vs long int) but still .. well, tier 2.

For the sake of test I did install apache from a binary package and built mod_php74 from ports. It works ok. This way you don't need to care about the apache24 source code.

The obligatory phpinfo() snippet:

PHP Version 7.4.32​

SystemFreeBSD fbsd13i 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC i386
Build DateOct 23 2022 22:52:04
Configure Command'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--with-libxml' '--with-password-argon2=/usr/local' '--program-prefix=' '--disable-cgi' '--disable-cli' '--enable-mysqlnd' '--with-apxs2=/usr/local/sbin/apxs' '--prefix=/usr/local' '--localstatedir=/var' '--mandir=/usr/local/man' '--infodir=/usr/local/share/info/' '--build=i386-portbld-freebsd13.1' 'build_alias=i386-portbld-freebsd13.1' 'PKG_CONFIG=pkgconf' 'PKG_CONFIG_LIBDIR=/usr/ports/www/mod_php74/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig' 'CPP=cpp' 'CXXFLAGS=-g -O0 -fstack-protector-strong -fno-strict-aliasing '
 
Hi Martin !

Thanks for the return !

And many thanks for the solution !

The Cloud is back online !

Resume of what I did :

Code:
pkg delete mod_php74
pkg install gcc
cd /usr/ports/www/mod_php74/
bash
export CC=/usr/local/bin/gcc
make install clean
exit
/usr/local/etc/rc.d/apache24 start

Everything works perfectly ! BIG thank you !

I wish u the best my friend.

Vince (France)
 
Sorry to keep you waiting for my report so long.
After my trying to start apache24 with mod_php82 on FreeBSD13.1 and an older hardware, I failed.
================================================================
hardware environment:
motherboard: ASUS TUF B360-PLUS GAMING
CPU: 8th Generation core-i5
chipset: B360
--------------------------------------------------------------------------------------------------------------
software environment:
Code:
    # uname -a
     FreeBSD sun.ptld.net 13.1-RELEASE-p2 FreeBSD 13.1-RELEASE-p2 GENERIC i386
    #pkg info |  grep apache24
    apache24-2.4.54
     #pkg info | grep  mod_php82
     mod_php82-8.0.2.r2_1
I couldn't detect the real reason that the combination of apache24 and mod_php82 is not good, but I succeeded in starting them up
as follows.
Code:
hardware environment:
     motherboard: ASUS PRIME H610M-A D4
     CPU: the 12th generation intel Core i-5 processor
     chipset: H610
software environment:
    # uname -a
    FreeBSD 12.3 sun.ptld.net 12.3-RELEASE r371126 GENERIC amd64 
    #pkg info |  grep apache24
    apache24-2.4.54
     #pkg info | grep  mod_php82
     mod_php82-8.0.2.r2_1
So I conclude that the problem lies in the combination of FreeBSD13.1 and mod_php74 - mod_php82.
 
I've been running FreeBSD in a lousy i386 GENERIC VM at RootBSD (now NetVantage) for 10+ years and have been fighting this problem all day. This thread finally spurred me on to finally registering for the forum. _martin's solution worked for me too, so wanted to say thanks -- I was stumped. As a retired embedded engineer of some 40 years, a compiler problem is the last thing I look for since, in all that time, I've only encountered a handful; maybe less than 10. And one involving clang is surprising too, as I consider it to be a much better compiler than gcc in all the respects that generally matter. And yet, here we are. I guess those optimized memory intrinsics can still bite you!

I had not updated my PHP in ages, and I had 7.4 core installed but a few php 5 modules (oh the shame). So this morning I stopped apache 24 and deleted everything and put 8.2 on. Boom! Signal 11. Deleted that and went to 8.1. Boom! Signal 11. Tried to go back to 7.4. Boom! Signal 11. AGHH!

Pulled out everything except php and mod_php. Boom! Signal 11. Updated FreeBSD. Rebuilt PKG dependencies. Forced reinstall of Apache. Updated every PKG. Boom! Signal 11.

/usr/local/sbin/httpd -X showed it was crashing inside LoadModule php_module libexec/apache24/libphp.so.

gdb of the coredump revealed this:

Code:
(gdb) bt
#0  0x73696874 in ?? ()
#1  0x21717da5 in ?? () from /usr/local/libexec/apache24/libphp.so
#2  0x216a600a in zend_register_functions () from /usr/local/libexec/apache24/libphp.so
#3  0x216a5e50 in zend_register_module_ex () from /usr/local/libexec/apache24/libphp.so
#4  0x216b4e5e in ?? () from /usr/local/libexec/apache24/libphp.so
#5  0x2169eb19 in ?? () from /usr/local/libexec/apache24/libphp.so
#6  0x2163e901 in php_module_startup () from /usr/local/libexec/apache24/libphp.so
#7  0x21771932 in ?? () from /usr/local/libexec/apache24/libphp.so
#8  0x21771310 in ?? () from /usr/local/libexec/apache24/libphp.so
#9  0x0045447c in ap_run_post_config ()
#10 0x00450509 in main ()

I was stumped. Had to be a library mismatch or something! Never a COMPILER PROBLEM!

BUT...yeah, switched to GCC, built mod_php 8.2 and all is working (actually built the Q3 22 Alpha 1 version, so need to switch to HEAD and do it again I guess, but it does work.) Anyway, the usual trivia below to close the loop, but thanks again (and it sure would be nice if clang was adjusted to correct the "official" pkg.)

But at least my system is now completely up to date! :)

Best and happy new year.

-- Ward

pkg info | grep php mod_php82-8.2.0.a1 PHP Scripting Language (8.2.X branch) php82-8.2.0.r2 PHP Scripting Language (8.2.X branch)

[/usr/local/etc/apache24] -> uname -a FreeBSD redacted.com 13.1-RELEASE-p3 FreeBSD 13.1-RELEASE-p3 GENERIC i386

Name : apache24 Version : 2.4.54 Installed on : Tue Dec 27 15:48:23 2022 PST Origin : www/apache24 Architecture : FreeBSD:13:i386

Code:
[/usr/local/etc/apache24] -> php -i
phpinfo()
PHP Version => 8.2.0RC2

System => FreeBSD redacted.com 13.1-RELEASE-p3 FreeBSD 13.1-RELEASE-p3 GENERIC i386
Build Date => Dec  1 2022 07:42:59
Build System => FreeBSD 131i386-quarterly-job-11 13.1-RELEASE-p5 FreeBSD 13.1-RELEASE-p5 i386
Configure Command =>  './configure'  '--disable-all' '--program-prefix=' '--with-config-file-scan-dir=/usr/local/etc/php' '--with-layout=GNU' '--with-libxml' '--with-openssl' '--with-password-argon2=/usr/local' '--enable-dtrace' '--enable-embed' '--enable-fpm' '--with-fpm-group=www' '--with-fpm-user=www' '--enable-mysqlnd' '--prefix=/usr/local' '--localstatedir=/var' '--mandir=/usr/local/man' '--infodir=/usr/local/share/info/' '--build=i386-portbld-freebsd13.1' 'build_alias=i386-portbld-freebsd13.1' 'PKG_CONFIG=pkgconf' 'PKG_CONFIG_LIBDIR=/wrkdirs/usr/ports/lang/php82/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig' 'CFLAGS=-O2 -pipe -fstack-protector-strong -fno-strict-aliasing ' 'LDFLAGS=-L/usr/lib -lcrypto -lssl -fstack-protector-strong -Wl,-z,notext' 'CPP=cpp' 'CXXFLAGS=-O2 -pipe -fstack-protector-strong -fno-strict-aliasing ' 'OPENSSL_CFLAGS=-I/usr/include' 'OPENSSL_LIBS=-L/usr/lib -lssl -lcrypto'
 
Do you have to run i386 at RootBSD - 64-bit is more common these days. So if you are upgrading everything might be an idea to move off 32-bit at the same time.
 
Do you have to run i386 at RootBSD - 64-bit is more common these days. So if you are upgrading everything might be an idea to move off 32-bit at the same time.
Yeah, I've decided to move to Contabo and save $200+ a year to boot. (Plus, pick up an additional 180GB of storage and 3GB of memory.) Should have left RootBSD/NetAcutate years ago. The new instance is amd64 and fast as blazes.
 
This is an interesting problem. Crash occurs within very first function apache calls from this module: create_php_config. But problem is not the source code itself (C code) but rather the assembly code. Long story short -- it fails to jump properly to memset (your core dump shows that too) because ebx register is bogus. But even if I manually set it to a proper value (which I can determine if I read the init part of module in assembly) it crashes elsewhere because other modules and even httpd core has problem with it. i386 architecture in general suffers from lack of generic purpose registers, maybe clang is doing something here which screw things up. Personally I've not seen this issue ever, such behavior among loaded libraries.

Having that in my mind I tried gcc11 and built the port this way:
Code:
pkg install gcc
cd /usr/ports/www/mod_php74/
export CC=/usr/local/bin/gcc
make install clean
And I was able to start apache properly.

Side note: I built apache, apr, mod_php74 from ports with debug symbols so I can navigate myself easier around the debugger. Funny enough apache24 won't build as is. I had to modify the source code of apache ; trivial modification of snprintf() because compiler flags were too strict (time_t vs long int) but still .. well, tier 2.

For the sake of test I did install apache from a binary package and built mod_php74 from ports. It works ok. This way you don't need to care about the apache24 source code.

The obligatory phpinfo() snippet:

PHP Version 7.4.32​

SystemFreeBSD fbsd13i 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC i386
Build DateOct 23 2022 22:52:04
Configure Command'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--with-libxml' '--with-password-argon2=/usr/local' '--program-prefix=' '--disable-cgi' '--disable-cli' '--enable-mysqlnd' '--with-apxs2=/usr/local/sbin/apxs' '--prefix=/usr/local' '--localstatedir=/var' '--mandir=/usr/local/man' '--infodir=/usr/local/share/info/' '--build=i386-portbld-freebsd13.1' 'build_alias=i386-portbld-freebsd13.1' 'PKG_CONFIG=pkgconf' 'PKG_CONFIG_LIBDIR=/usr/ports/www/mod_php74/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig' 'CPP=cpp' 'CXXFLAGS=-g -O0 -fstack-protector-strong -fno-strict-aliasing '
Hello Martin

I've had the same problem with FreeBSD 13.2 and php 8.3.
Your solution helped me. I reinstalled from ports php and all its modules.

Thank you very much!
 
Back
Top