pthreads and wampserver3
Posted by: iaejean (---.cablevision.net.mx)
Date: January 30, 2016 05:57PM

Hi!,

I'm having problems with pthreads, I would wish test threads in php so reading I found a implementation for PHP called pthreads, I have a windows 10 64bits, wamp server 3.0.1 32 bits, with php 7.0.2 and apache 2.4.17, on my phpinfo I have Compiler MSVC14 (Visual C++ 2015), so based on the most of post I've downloaded php_pthreads-3.1.5-7.0-ts-vc14-x86.zip in [windows.php.net] and copy php_pthreads.dll to my ext directory in php 7.0.2 and pthreadVC2.dll to same directory that php.exe in php 7.0.2, bin in apache and system32, I add in php.ini extension=php_pthread.dll and when I restart apache this simple don't start, if I run php on command, I got Fatal error: Class 'Thread' nor found in ~ , sombody have idea why I couldnt start apache?

Sorry my Englisht!

Regards!

Options: ReplyQuote
Re: pthreads and wampserver3
Posted by: Otomatic (Moderator)
Date: January 30, 2016 06:20PM

Hi,

PHP documentation said :
pthreads requires a build of PHP with ZTS (Zend Thread Safety) enabled ( --enable-maintainer-zts or --enable-zts on Windows )
Caution Zend Thread Safety cannot be enabled post build; it is a build time configuration option.

It does not seem to me that the PHP versions for Windows are compiled with ZTS.
phpinfo () said:

Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"

There is no --enable-zts.

Test for you.

Comment the extension extension=php_pthread.dll in php.ini, launch Wampserevr with green icon then Icon Wampmanager->PHP Extensions->php_pthread

You also can see why Apache does not start in log files.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: pthreads and wampserver3
Posted by: iaejean (---.cablevision.net.mx)
Date: January 30, 2016 07:13PM

Thanks for you answer, I did what you say and I got:

[30-Jan-2016 17:43:45 UTC] PHP Fatal error: The apache2handler SAPI is not supported by pthreads in Unknown on line 0
[30-Jan-2016 17:43:45 UTC] PHP Fatal error: Unable to start pthreads module in Unknown on line 0

I look for the cause and I found the next information [stackoverflow.com] , so that means that I won't be able to use pthreads? even when I could get a build compiled with ZTS? I'm emulating threads using Symfony Process on production with commands with "nohup [command] &", I was looking for elegant solutionj.

Thanks agains!

Options: ReplyQuote
Re: pthreads and wampserver3
Posted by: Otomatic (Moderator)
Date: January 30, 2016 07:57PM

Hi,

In theory, unknown on line 0, is because the necessary DLL is not in wamp/bin/Apache/apache2.4.17/bin/ folder.

Instead.of copy file, you may put symbolic link.
You may also add names of dll to copy in the array in the scripts/config.inc.php file. Each time you launch or refresh Wampserver, the symlink are verified from this array.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: pthreads and wampserver3
Posted by: iaejean (---.cablevision.net.mx)
Date: January 30, 2016 08:50PM

Thanks one more time, this time I got :

[Sat Jan 30 13:28:01.439354 2016] [auth_digest:notice] [pid 30368:tid 664] AH01757: generating secret for digest authentication ...
[Sat Jan 30 13:28:01.617407 2016] [ssl:warn] [pid 30368:tid 664] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]

After that Apache don't Start, but I think that I should be able to use pthread on command line but I still getting "Fatal error: Class 'Thread' nor found in ~ "

Options: ReplyQuote
Re: pthreads and wampserver3
Posted by: iaejean (---.cablevision.net.mx)
Date: January 30, 2016 09:21PM

Well, to close, maybe with all that information I don't need start apache with php and pthreads what I need or my main need for threads is something like daemon running "n" tasks or scripts on threads, so I could get another php7 compiled with zts and pthreads etc my web server will run my app, and my daemon will run the other php with the tasks in threads, sorry I know this is not about wamp, but I would thank your help and opinion.

Options: ReplyQuote


Sorry, only registered users may post in this forum.