Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to try threads in PHP on my Ubuntu 12.04 machine. I understand that I need ZTS support in PHP in order to use the pthreads PECL extension. I uninstalled PHP and built it from source with the --enable-maintainer-zts option (I also applied the Suhosin patch). The PHP installation seems to be working (I can run all my applications).

The problem starts when I try to install pthreads. When I run "pecl install pthreads" I get the following error message:

In file included from /tmp/pear/temp/pthreads/php_pthreads.c:238:0:
/tmp/pear/temp/pthreads/classes/thread.h: In function ‘zim_Thread_kill’:
/tmp/pear/temp/pthreads/classes/thread.h:473:6: error: ‘SIGUSR1’ undeclared (first use in this function)
/tmp/pear/temp/pthreads/classes/thread.h:473:6: note: each undeclared identifier is reported only once for each function it appears in
In file included from /tmp/pear/temp/pthreads/php_pthreads.c:242:0:
/tmp/pear/temp/pthreads/classes/worker.h: In function ‘zim_Worker_kill’:
/tmp/pear/temp/pthreads/classes/worker.h:380:6: error: ‘SIGUSR1’ undeclared (first use in this function)

I tried to manually add signal.h to php_pthreads.c, but that led to a whole bunch of other problems. So it seems like something is missing in my installation.

Does anybody have any ideas I can try?

Edit: I'm using PHP 5.3.9

share|improve this question

migrated from serverfault.com Feb 17 at 18:39

This question came from our site for professional system and network administrators.

1  
There's something about the concept of threading in PHP that fills me with terror. –  Tom O'Connor Feb 17 at 9:43
    
The core PHP has been thread safe for a very long time - there are probably still some dodgy extensions around - but it's completely pointless on a Linux system unless you're trying to eke the last few CPU cycles out of a "hello world" benchmark. –  symcbean Feb 17 at 21:43
    
I'm making a gallery application and it takes quite a long time to create the thumbnails when adding new images. Around 2.5 min for 110 images. So I'm thinking I might be able to cut that time using multiple threads. –  Peter Welzien Feb 18 at 15:15
    
How I'm able to reproduce this? –  Braiam Feb 20 at 16:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.