Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Pthreads PHP extension in Ubuntu

I have problems with the Pthreads PHP extension. I have compiled PHP with ZTS enabled (--enable-maintainer-zts) and installed the pthreads via pecl and also tried to manually compile the extension.

It seems I don't actually know how to use it. I assumed I would be able to use the Thread class in PHP like any other built-in class, but with no luck as PHP doesn't recognize it. POSIX functions seem to work.

I am using Ubuntu 12.10 Server 64-bit with mod_php 5.4.6.

like image 249
Henri Ruutinen Avatar asked Oct 22 '22 21:10

Henri Ruutinen


1 Answers

If you cannot access the extensions classes then it is not loaded.

I think you opened a bug report, to which I responded that your configure line is malformed.

The configure line you want to use is:

./configure --enable-pthreads --enable-maintainer-zts

The above command will build pthreads as a DSO.

./configure --enable-pthreads=static --enable-maintainer-zts

The above command will build pthreads statically into PHP.

Both are equally supported by 5.3, 5.4 and even 5.5.

Additionally, if you are overwriting your system installation then you should use a specific --prefix, for example, if you php executable is at /usr/bin ( which you can ascertain with "which php" ), then --prefix=/usr will overwrite your system installation.

Clean out your old installations ( do make uninstall if the sources are still available ). Start again, ensure you are either, overwriting the system installation or isolating this one completely.

Please update the bug report when you have worked it out.

like image 67
Joe Watkins Avatar answered Oct 24 '22 11:10

Joe Watkins