Don’t Believe The Lies: PHP Isn’t Thread-Safe Yet

If you took everything you heard for granted, you’d have been lead to believe that the official PHP distributions (from php.net) have been thread-safe since version 5.2.0.

That’s not true. Don’t fall for it. Don’t attempt to use PHP in a multi-threaded environment (mpm_worker on Apache, ISAPI on IIS, etc.), because PHP thread-safety is a myth.. nothing more than a bunch of lies, if you will.

If you look at the PHP download page, you’ll see that the pre-built binaries (in this case, Windows) are split into two: thread-safe and non-thread-safe:

Thread-Safety

The problem is, no matter which you choose, PHP isn’t thread safe. You’ll still get the same, old, dreaded “PHP has encountered an access violation at memory_address” error.

It’s not a question of server configuration so much as it is one of PHP writing bad code and pretending that’s not the case. PHP isn’t multi-threading ready and most everyone knows it… but it seems they still feel the need to pass it off as if it were, never mind the complaints and bug reports that come.

Continue reading

Microsoft FastCGI Updated – But Should You Upgrade?

We previously covered the final release of the IIS FastCGI module, jointly developed between Microsoft and Zend… But just this week, Microsoft [[MSFT]] announced the availability of the RTM of the IIS FastCGI module.

So what’s going on? We’ve downloaded the current release (which, by the way, is not compatible with the old one, you must uninstall then install the new version) and checked the version number on \Windows\System32\inetsrv\fcgiext.dll – it came out to be 6.1.36.1.

By contrast, the version we downloaded and installed a month ago (which seems to have been dubbed the Go Live release) was checked and found to be 7.0.6001.16606.

Obviously the Go Live release was using the numbering from the Microsoft Windows Server 2008 releases, but it’s got us confused.

Continue reading

FastCGI for IIS Final Released, Congratulations to the IIS Team!

Congratulations are in order for Microsoft’s IIS development team – today they’ve just announced the public availability of the final version of the IIS-FastCGI ISAPI Extension – a long-awaited and much-improved way of running just about any open-source scripting engine on IIS, safely and quickly.

The Microsoft [[MSFT]] FastCGI module for IIS 5.1, 6, and 7 (with Windows Vista and Server 2008) have been in the works for quite a while now, and we’ve been using them since the first beta release – they’re good. While the biggest benefit will be seen in using FastCGI w/ IIS7 to take advantage of the new kernel-mode caching, it’s still a huge improvement over the old way of running scripting engines for languages like PHP on Windows.

The Problem: Most open-source scripting engines like PHP and Ruby on Rails were initially developed on/for the *nix world. On Unix-based platforms, the easiest way of creating multi-threaded applications is just to run the same app twice or more (The CGI model). On Windows, that doesn’t work out so well, because it takes a lot more resources to create another process. So these engines released Windows-specific single-process multi-threaded engines; the only problem was, they weren’t stable. Too many race conditions in some very non-thread-safe code wreaked havoc on many Windows systems, with the PHP developers themselves giving “Stability on IIS” the lowest level of concern.

Continue reading

eAccelerator PHP Extension Isn’t Thread-Safe…

For all the Windows-bound PHP users out there, consider yourselves warned: even if you’re running the (supposedly) thread-safe PHP Win32 binary redistribution, you’re still susceptible to PHP Access Violation Errors, race problems, heap corruption, and much worse if you use the popular eAccelerator opcode-caching extension.

We did our testing with the binaries compiled by SiteBuddy using the latest versions of both PHP and eAccelerator. Almost immediately after initiating a stress test on our test servers we experienced the dreaded “PHP Access Violation” error – which brings down the entire IIS Worker Process to its heels.

Continue reading

No More Downtime!

It seems that every time we get on Slashdot (or Digg for that matter), we go down. It doesn’t make a difference just how well prepared we are, what kind of hosting we’re using, what the application being Slashdotted is, etc. It’s the unwritten law at NST. But we hope this’s the last time we ever experience downtime for a while.1

Why? We’ve left PHP. Well, not exactly. It seems that PHP doesn’t give a damn about Windows users. PHP has repeatedly stated that “we’re aware of [….] serious stability issues on Windows…” But they’ve done nothing about it for almost a year now. Their advice is to abandon (their own) PHP ISAPI connector and instead fallback to the ages-old and incredibly slow PHP CGI solution.

Continue reading


  1. Currently, NeoSmart Technologies is running off of a dedicated host (from LunarPages) with eAccelerator, MySQL, WP Cache, and some more optimization goodiness.