# php74 and mod_php74 problem with --enable-maintainer-zts



## tsk (Dec 20, 2021)

Hi,

I need php74 (-7.4.26) and mod_php74 (-7.4.26). I can compile php74 without problems but can not successfully compile mod_php74.
mod_php74 fails due to a configuration error about not being able to evaluate posix threads availability. I sent a problem report to the maintainer, but didn't get a response so far.

Somebody wrote that this may be fixed by setting a CONFIGURE_ENV+=pthreads_workin="yes" in the php74 Makefile.
That actually allows to compile, link and install mod_php74, but that leads to a problem with the php extensions for apache.

Apache shows errors that it cannot load dynamic libraries like xmlreader.so - many of them - from a path /usr/local/lib/php/20190902-zts/...
On the machine there is not such a directory but one /usr/local/lib/php/20190902 without the trailing "-zts".
In the directory /usr/local/lib/php/20190902 I can find all the php extensions apache complaints about not to be able to read.

As far as I understand the directory /usr/local/lib/php/20190902-zts is for such extensions that are build with the zts option.
As I did not set this option I assume from reading the config and Makefiles that it is the --enable-maintainer-zts settings that leads to that situation.
I'm trying to get rid of this setting but I'm unable to. I commented some lines in the php74 Makefile:
.if ${PORT_OPTIONS:MZTS} ...
but that didn't help.

Does anybody have a clue what is going on and how to fix that?


----------



## Alain De Vos (Dec 20, 2021)

Fyi there are also these bugs with zts,





__





						254752 – www/apache24: event_mpm requires PHP ZTS which conflicts with DEBUG
					






					bugs.freebsd.org
				








__





						242289 – databases/php73-pdo_sqlite databases/php74-pdo_sqlite: Build fails if ZTS option of lang/php7[1-4] is enabled
					






					bugs.freebsd.org


----------



## richardtoohey2 (Dec 20, 2021)

Do you want ZTS enabled or not?

I usually turn it off and don't have trouble building PHP 7.4 and mod_php74.

There's definitely a way you can get stuck in a bit of a vicious circle with mod_php and PHP so if you do get stuck - easiest to clean everything out and try again.

You can compile one, but not the other, and even changing options doesn't seem to help - so if you get to that, clean down everything and start again.

For me:


```
cd /usr/ports/lang/php74
make config
CLI, FPM, DTRACE, MYSQLND - everything else off (including ZTS and LINKTHR)

cd /usr/ports/www/mod_php74
make config
DTRACE, MYSQLND - everything else off (including ZTS and LINKTHR)
```

Even if this is not what you want - you can try this to see if you can get both to build, and then move on.


----------



## tsk (Dec 22, 2021)

richardtoohey2 said:


> Do you want ZTS enabled or not?
> 
> I usually turn it off and don't have trouble building PHP 7.4 and mod_php74.
> 
> ...


No, I do not want ZTS enabled.
I actually cleaned both and tried again, no help.
I stopped fiddling with that and used the packages. The packages do not use ZTS, so there must be a way to make it.
I contacted the maintainer, but no response.


----------



## Alain De Vos (Dec 22, 2021)

By default option ZTS is off but to make sure you can always add to make.conf

```
OPTIONS_UNSET+=ZTS
```


----------



## tsk (Dec 22, 2021)

Alain De Vos said:


> By default option ZTS is off but to make sure you can always add to make.conf
> 
> ```
> OPTIONS_UNSET+=ZTS
> ```


As I said: This is not about the regular ZTS option rather than the --enable-maintainer-zts option...


----------



## Alain De Vos (Dec 22, 2021)

Another option is passing parameters to the configure script. Something like,
E.g.
.if
CONFIGURE_ARGS+="--disable-maintainer-zts --without-tsrm-pthreads"
.endif
Or add this to the port makefile.


----------

