• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Install pthreads for PHP in PLESK

Johnny9977

Basic Pleskian
I'm looking for a way to install pthreads in PLESK for PHP. I've searched a lot but can't find any tutorial or How-To for this. Is there anyone who can say me how I can install pthreads in PLESK?

krakjoe/pthreads

I need to do this because I'm getting an error message when I try to extend a class in PHP by Thread:

PHP:
Fatal error: Class 'Thread' not found

I've checked the installed modules in PLESK but there is no pthreads to enable

https://i.stack.imgur.com/B1R2B.png
 
You can try to compile pthreads module for Plesk PHP with something like:

# apt-get install make gcc plesk-php73-dev
# /opt/plesk/php/7.3/bin/pecl install pthreads

and so on, but you will see error:

checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pthreads/configure --with-php-config=/opt/plesk/php/7.3/bin/php-config' failed

The problem in that Plesk PHPs are compiled without ZTS.
But you can compile your own PHP version with ZTS, register it in Plesk as your own custom PHP and then compile pthreads module for this PHP.
How to compile and register your compiled PHP is documented. Try to find it.
 
You can try to compile pthreads module for Plesk PHP with something like:

# apt-get install make gcc plesk-php73-dev
# /opt/plesk/php/7.3/bin/pecl install pthreads

and so on, but you will see error:

checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pthreads/configure --with-php-config=/opt/plesk/php/7.3/bin/php-config' failed

The problem in that Plesk PHPs are compiled without ZTS.
But you can compile your own PHP version with ZTS, register it in Plesk as your own custom PHP and then compile pthreads module for this PHP.
How to compile and register your compiled PHP is documented. Try to find it.

I'm now at the recompile step with ZTS but I don't get it..
 
Here is instruction How to add a custom PHP version?
You just need to add --enable-maintainer-zts option for configure.
But note that this is not a trivial task and some additional experiments, configuring and customizations may be required.
 
Back
Top