3

I have a web application and is running fine with PHP 5.5.5 on a production environment.

On the same server now I need to run some PHP scripts that make use of php pthread (v. 2.0.10)

Is it safe to rebuild php with --enable-maintainer-zts (to allow use of pthreads) and use the same executable both for the web application and the CLI scripts that use php-pthread ?

Or should I make two builds of PHP: php, php-zts and use the former for the web app and the latter for the CLI scripts ?

As --enable-maintainer-zts is not enabled by default I assume it have some drawbacks or worse (as I have read here https://github.com/travis-ci/travis-ci/issues/985) may introduce misbehaviours (bugs).

The web stack is nginx + php-fpm + mySql on Mac OS X 10.9.5.

I want it to be clear: phtread will not be used by the web application scripts. Only by the CLI scripts.

Paolo
  • 15,233
  • 27
  • 70
  • 91

1 Answers1

4

From http://www.phpinternalsbook.com/build_system/building_php.html

(emphasis mine)

--enable-debug enables debug mode

[...]

--enable-maintainer-zts enables thread-safety.

[...]

you should not use either of these options if you want to perform performance benchmarks for your code, as both can cause significant and asymmetrical slowdowns.

--enable-maintainer-zts seem not harmful but affects performances. So it's definitely not advisable in a production environment.

A separate build of PHP with --enable-maintainer-zts in order to use php pthread in CLI scripts is the appropriate way to go.

Community
  • 1
  • 1
Paolo
  • 15,233
  • 27
  • 70
  • 91