krakjoe / pthreads

Threading for PHP - Share Nothing, Do Everything :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extension directive

VARGA-Peter opened this issue · comments

Environment

  • PHP: can be obtained with php -v
    7.2.9
  • pthreads: can be obtained with php -dextension=pthreads.so --ri pthreads | grep Version
    3.1.7dev
  • OS: if Windows, include arch
    SLES 12.3

Summary

How to set extension=pthreads permanently in the php.ini so Apache 2.4 restart doesn't fail with the error message PHP Fatal error: The apache2handler SAPI is not supported by pthreads in Unknown on line 0?

In other words, is there a way that the Apache and CLI settings can be distinguished in one php.ini file?

For the moment the only work-around is putting the extension directive into a separate file /etc/php7/cli/php.ini and passing the -c switch with the path when running the php CLI version.

You write

Update your php.ini file to load the pthreads.so file using the extension directive

but this only works as I described above.

No. Pthreads v3 is restricted to operating in CLI only. So one single *.ini for apache and cli sapi is not possible.

pthreads v3 is restricted to operating in CLI only: I have spent many years trying to explain that threads in a web server just don't make sense, after 1,111 commits to pthreads I have realised that, my advice is going unheeded.

I got it, no need to repeat it.

Your So one single *.ini for apache and cli sapi is not possible confirms that it is mandatory to have separate *.ini files for apache and cli otherwise you cannot run it.

Good, then in other words when my English is too bad that my polite hint was not understood:
May be you can re-consider to change Update your php.ini file to load the pthreads.so file using the extension directive to something like this:

Create a new php.ini file and use the -c switch with the path to it when running the CLI version of php.

When you add into the same php.ini file [which is also used for apache] the extension as recommended then it is NOT working. Just make this fact more clear. For you as a pthreads developer it is clear but there are 99,99% of people they don't deal with it and the hint may help them. It is also called empathy.

Thank you