0
votes

I have installed pthreads by the following http://php.net/manual/en/pthreads.installation.php from http://windows.php.net/downloads/pecl/releases/pthreads/

My php info :- phpinfo();

PHP Version 5.6.30 Compiler : MSVC11 (Visual C++ 2012) Architecture : x86 Thread Safety : enabled

But error still exists..

php -m output#

php -m PHP Warning: PHP Startup: pthreads: Unable t Module compiled with module API=20121212 PHP compiled with module API=20131226 These options need to match in Unknown on line 0 Warning: PHP Startup: pthreads: Unable to ini Module compiled with module API=20121212 PHP compiled with module API=20131226 These options need to match in Unknown on line 0 [PHP Modules] bcmath bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash iconv json libxml mbstring mcrypt mhash mysql mysqli mysqlnd odbc

2
are you sure, you have added extension=php_pthreads.dll to the correct php.ini?Philipp
what is your php -m output ?hassan
Thread Safety: enabled is not about pthreads extension.Furgas
yes i have added extension=php_pthreads.dll properly..Rajbir
here are php -m output# php -m PHP Warning: PHP Startup: pthreads: Unable t Module compiled with module API=20121212 PHP compiled with module API=20131226 These options need to match in Unknown on line 0 Warning: PHP Startup: pthreads: Unable to ini Module compiled with module API=20121212 PHP compiled with module API=20131226 These options need to match in Unknown on line 0 [PHP Modules] bcmath bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash iconv json libxml mbstring mcrypt mhash mysql mysqli mysqlnd odbcRajbir

2 Answers

0
votes

Whilst Hassan Ahmed's reply explains why pthreads shouldn't be used in a web server environment, that is not the cause of the error you're receiving.

The problem is that the pthreads binary you have downloaded was not built for the PHP version you are using. This causes a mismatch between the pthreads' binary API and PHP's module API that it integrates into. Judging by your PHP version, you should be using the 2.0.10 release of pthreads, since that was the last stable release for PHP 5.6 version.

Note that support for pthreads for PHP 5.x versions is no longer maintained. If you would like the latest bug fixes and features, then use PHP 7.x and pthreads v3.

1
votes

pthreads is not safe for web server environments (source) :-

I didn't disable pthreads in web server environments to annoy you; I done it to keep you safe, and will not reverse that decision.

PHP and Apache do not provide the API required to make it properly safe.

If I patched Apache and PHP tomorrow to include some additional hooks in an effort to make it properly safe, you would never be able to make it scale.

Threads are not a utility for an Apache worker mpm server, they are part of the architecture of the software; Coming in and starting additional threads inside that architecture is reckless and destroys the ability of that architecture to scale and operate as it was intended.

It never made sense to use pthreads inside Apache, I left it working in previous versions in an attempt to lower the entry barrier (everyone is comfortable with a web server). That was a mistake, my mistake; Threading is not simple, when you try to make something inherently complicated simple, you just make it stupid.

Allowing threads to be started inside Apache without the ability to make either PHP or Apache properly aware of the change in architecture was abusive, and extremely stupid.

another note , that apache2 by default running in mpm_prefork mode , which is means that -so to speak- " hey apache2 , please fork for me multi child processes , but with one thread for each"