krakjoe / pthreads

Threading for PHP - Share Nothing, Do Everything :)
Other
3.47k stars 503 forks source link

Delay 'The cgi-fcgi SAPI is not supported by pthreads' #750

Open kelunik opened 7 years ago

kelunik commented 7 years ago

Could the The cgi-fcgi SAPI is not supported by pthreads error message be delayed until pthreads is actually used instead of only loaded? That'd allow having a single php.ini for all binaries / compiling pthreads directly into the binaries instead of as shared extension.

My1 commented 7 years ago

I totally agree on this.

userqq commented 7 years ago

you can enable pthreads for script with -dextension argument and run script by command:

php -dextension=pthreads.so script.php

or add to file #!/usr/bin/php -dextension=pthreads.so, e.g:

#!/usr/bin/php -dextension=pthreads.so
<?php

var_dump(class_exists('Thread'));

then make file executable and run it like ./script.php P.S.: Please note the second way requires unix line-endings in file

sirsnyder commented 5 years ago

That won't be possible. Instead of one single module check, this check would have to be done in every pthreads API method. But maybe we could silence the PHP_MINIT_FUNCTION abortion by a param or ini setting, if that's technically feasible and would help?