Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any harm in using a thread-safe extension (APC) in a non-thread environment? (PHP)

I was going to use this Simple PHP Upload with a Progress Bar, and it says I need the APC extension. I have two options with APC, thread-safe, and non-thread-safe.

using phpinfo, I find that thread-safety is enabled, but I'm not sure if php is actually running mutithreaded. I hear that php is still kinda beta for mutithread.

Anyways, if my PHP is not mutithreaded and wasn't "thread-safe", would there be problems using a thread-safe version of APC?

tl;dr version: Does thread-safe APC mean more compatibility (works in both php single/mutithread), or does it mean mutithread required (works only in php mutithread)?

like image 841
TachisAlopex Avatar asked Oct 08 '22 11:10

TachisAlopex


1 Answers

if my PHP is not mutithreaded and wasn't "thread-safe", would there be problems using a thread-safe version of APC?

Yes - it won't work, period. Thread safety is a compilation setting that must match up for PHP itself and all the extensions, otherwise they can't be loaded. Here's an article that explains the difference in great detail.

Note that besides the TS/NTS setting, you also need the CPU architecture (x86 vs x64) and the version of Visual Studio used to compile (VC6 vs. VC9) to match in order for an extension to work, and the version of the extension may work only with a certain major version of PHP.

All this means that it can be pretty damn hard to get the right precompiled binary of an extension to work with your PHP installation.

like image 142
Michael Borgwardt Avatar answered Oct 14 '22 13:10

Michael Borgwardt