apache24 with mod_php82 won't start up.

Could you anyone help me to solve the following problem.
I've installed apache24 and mod_php82. But apache won't start up at all.
I show you general idea of my FreeBSD machine as follows.

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                Version 2.4.x of Apache web server

# pkg info | grep mod_php82
mod_php82-8.2.0.r4_1           PHP Scripting Language (8.2.X branch)

root@sun:/usr/local/etc/apache24 # cat httpd.conf | grep "php_module"
LoadModule php_module         libexec/apache24/libphp.so

root@sun:/usr/local/etc/rc.d # ./apache24 start
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.

root@sun:/usr/local/etc/rc.d # tail -n 2 /var/log/messages
Oct 16 21:46:12 sun su[33894]: chris to root on /dev/pts/0
Oct 16 21:52:31 sun kernel: pid 33917 (httpd), jid 0, uid 0: exited on signal 11(core dumped)

When I remove(or make commented) the following line from the httpd.conf, apache will start up successfully.
Code:
LoadModule php_module         libexec/apache24/libphp.so

Is there anything I can submit to solve my problem?
 
Last edited by a moderator:
Alain and Voltaire, thank both of you for your replies.
I tested on both mod_php80 and mod_php81 in vain.
I began to think that this problem is something due to the hardware on my FreeBSD13.1.
For example, the followings are some of the hardware devices.
1. CPU: the 12th generation CORE-i5 (i5-12400F, 18MB Cache, LGA1700)
2. mother-board: ASUS PRIME H610M-A D4 (Intel H610 chipset)

I think that mod_php is working on the newwer version of the hardware while it thinks that it is working on older version of the hardware.
That's why core dump occurs.

I will report the result after I test apahce24 with mod_php82 on older version of hardware like the 11th generation CPU the suitable mother-board.
 
I saw today that I am using mod_php80 and not mod_php81 but I think the latter will work too.

You have a configuration file of the Apache server and I think you should mention mod_php in it correctly. It could be that your apache configuration file contains errors. Often when I can't get Apache to run it's because of a configuration error.
 
Some things I see in the configuration file that seem important to me.
/usr/local/etc/apache24/httpd.conf
Code:
LoadModule php_module         libexec/apache24/libphp.so
LoadModule php7_module        libexec/apache24/libphp7.so

# Third party modules
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

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

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Include etc/apache24/Includes/*.conf

Anyway this configuration worked the last time I tried to use Adminer to manage PostgreSQL and MySQL databases.
It's not my complete httpd.conf but the things you may have done wrong.
 
Maybe you shouldn't try to load both mod_php74 and mod_php82?

Again an issue with having conflicting ports installed. It's not possible to have both www/mod_php74 and www/mod_php82 installed.
When I run the pkg info command I see that the following two packages are present on my system.

mod_php74-7.4.32_1 PHP Scripting Language
mod_php80-8.0.24 PHP Scripting Language

I'll check tonight which PHP version Apache is using with this configuration, but I'm sure Apache used to work correctly with this configuration.
 
When I run the pkg info command I see that the following two packages are present on my system.

mod_php74-7.4.32_1 PHP Scripting Language
mod_php80-8.0.24 PHP Scripting Language
This isn't possible unless you forcefully installed them. There's something seriously wrong with the way you install ports/packages. mod_php80 conflicts with mod_php74.
 
This isn't possible unless you forcefully installed them. There's something seriously wrong with the way you install ports/packages. mod_php80 conflicts with mod_php74.
I don't have that many duplicate packages on my system with different versions. I think you got the wrong impression purely by chance because of the ldap problem. But we don't know why I had this ldap problem.

I couldn't start Apache, and I thought it needed a different PHP version to work. Anyway, I was able to simply install it with pkg install xxx Shouldn't it throw an error if both packages can't coexist? For example with PostgreSQL it will also give an error if you have installed version 13 and then order to install another version.
 
Shouldn't it throw an error if both packages can't coexist?
It should, yes. But apparently it doesn't. At least not for mod_phpXX. I distinctly remember this was certainly the case in the past. It does correctly detect the conflict for phpXX.
Code:
Checking integrity... done (1 conflicting)
  - php80-8.0.24 conflicts with php74-7.4.32 on /usr/local/bin/php
A mod_phpXX without the accompanied phpXX is pretty useless. Having mod_php80 and php74 (or mod_php74 and php80) isn't going to work either.
 
If I uncomment the LoadModule php7_module libexec/apache24/libphp7.so in /usr/local/etc/apache24/httpd.conf I get the following error message:

Code:
service apache24 onestart
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.
Segmentation fault (core dumped)
/usr/local/etc/rc.d/apache24: WARNING: failed to start apache24

If I comment this line, Apache can start:

Screenshot_2022-10-19_20-40-48.png
 
While others are helping with the configuration part of the problem can you share the reason of the fault? For that you need to have gdb installed though. Run the following code gdb /usr/local/sbin/httpd /path/to/corefile. Then within gdb run the following command: bt. Once I have more time I'll try to reproduce this in my setup.

edit: apache24 and mod_php80 works just fine with me. So the dump is really needed to see what's going on there.
 
As most, if not all, PHP applications depend on one or more modules. Those modules all depend on the phpXX port, nothing depends on mod_phpXX because you can run your PHP applications through PHP-FPM instead of mod_php.
 
Voltaire are you certain you have only one, and only one version of php ?
I.e. mod_phpXY & phpXY-... as packages installed ?
When I run pkg info I can see that the following packages are installed:
php80-8.0.24
mod_php74-7.4.32_1
mod_php80-8.0.24

So php has only one version installed but mod_php has two different versions installed, you know what I mean. However, I noticed something interesting in my test last night.

Code:
LoadModule php_module libexec/apache24/libphp.so
#LoadModule php7_module libexec/apache24/libphp7.so

With the above configuration, apache24 will start up successfully and you will see the php version you saw in the screenshot of my previous post.
But I can also configure it in the following way:
Code:
#LoadModule php_module libexec/apache24/libphp.so
LoadModule php7_module libexec/apache24/libphp7.so

In the above case, apache24 will also start up successfully. When I browse to localhost/info.php with this adapted configuration it says PHP Version 7.4.32 (instead of 8.0.24)
What I think is that SirDice has a lot more technical knowledge than I do. I can only describe what it looks like to me and not say for sure how it is.

It seems for me that things may depend on mod_php74. (which contradicts SirDice). It also seems like you can install only php80-8.0.24 and mod_php74-7.4.32_1 and then you can use this mod_php74 in apache24 without any problems.

The latter also seems interesting to the OP, that mod_php74 still seems to work fine.
 
I think you best remove all packages mod_php74*.
Then you have a system only running php80 and normally that will work fine.
PHP 7.4 will get security updates until November 28: https://kinsta.com/wp-content/uploads/2018/06/supported-php-versions-for-wordpress-1.png

In production you can only use it until that date.

For local use on a system that is not connected to the internet, I suspect that you can continue to use PHP 7.4 for a few more years without this being a problem.

I have uninstalled the mod_php74-7.4.32_1 package currently.

The best practice would probably be to use PHP 8.1 instead of PHP 8.0 for the following reason:
A release that is being actively supported. Reported bugs and security issues are fixed and regular point releases are made.

PHP 8.0 is almost in the Security fixes only phase:
A release that is supported for critical security issues only. Releases are only made on an as-needed basis.
 
You can have more versions of php running on a same web server. You can configure multiple vhosts running different php versions if required or desired. The ModuleIdentifier in LoadModule makes it possible to distinguish between these versions.
Of course you can't have conflict and install both versions to the same location.

It would be interesting to see why the crash occurs assuming you have both modules and apache installed from binary packages.
 
Hi, thanks for all your posts, because since a "pkg update -y", I have face exactly the same issue and couldn't find the problem.

My server is an old Inter Core2duo :
> FreeBSD 13.1-RELEASE-p2 GENERIC i386

After this update, PHP, switch from 7.4.30 to 7.4.32.
Before that everything was working perfectly.

Details :
Oct 22 00:59:36 HOST pkg[65952]: php74-sqlite3 upgraded: 7.4.30 -> 7.4.32
Oct 22 01:00:19 HOST pkg[65952]: php74-pdo_sqlite upgraded: 7.4.30 -> 7.4.32
Oct 22 01:02:31 HOST pkg[65952]: mod_php74 upgraded: 7.4.30 -> 7.4.32_1
.../...

The difference in my case is that I have only one version of PHP, witch is now after update :

Details :
# pkg info | grep php
- php74-7.4.32
- mod_php74-7.4.32_1
.../...

And a Nextcloud :
- nextcloud-php74-24.0.5

My Apache config looks like this :

# cat /usr/local/etc/apache24/httpd.conf | grep php | grep so$
LoadModule php7_module libexec/apache24/libphp7.so

So when this line is commented, Apache starts properly.

I tryed to "truss" the startup of Apache :
truss -o Debug_apache3.txt -f -s 1000 /usr/local/etc/rc.d/apache24 start

but no revelant info on it for my small knowledge.

I will try to rollback and re install the 7.4.30 and test again. I let you know the result.

Thanks again for your posts. I was becoming crazy !

Vince
 
In the generic setup make sure you don't have conflict with the modules, i.e. you're not trying to install different versions of php from ports/binary packages. Your pkg output shows you don't have it, so it should be fine.
The best thing would be to show or share the core dump. That's the best way to determine what's happening.
 
Thanks for you reply

Can you tell me how to make this verification ? (make sure you don't have conflict with the modules)

httpd -M ?

My pkg info | grep php only show on version.

No im not trying to install different versions of php. I would like to have my Cloud back online. Evrything was working perfectly before that pkg update.

Since the pkg update, Apache is no longer starting if this line is not commented in my httpd.conf :

LoadModule php7_module libexec/apache24/libphp7.so

I have try to switch to PHP8 by installing mod-php8, but im having the same issue when trying to start Apache.

Maybe it is a problem of my architecture who is under i386.... just guessing.

Here is the dump file generated under PHP7 and the truss output when lauching.

Thanks for the help.
 

Attachments

  • httpd_core.zip
    401.1 KB · Views: 70
  • Debug_apache.zip
    141.7 KB · Views: 77
Back
Top