OK--I'll answer the obligatory question before it's asked:-): Does Apache 2 work with PHP yet?
A: Yes, but only if you use the (default) Apache prefork module with PHP. Some libraries used by PHP are
not thread-safe, so you cannot use the multiple thread model.
For details on using Apache 2 and php see my FAQ at
http://dan.drydog.com/apache2php.html
What exactly does "not thread-safe" mean? I've been running php5 with apache2, though in WinXP, for about 8 months, and I haven't really had any major problems, aside from stupid programming errors.
Saying a program is not thread-safe essentially means that it doesn't do the proper chicken dancing to coordinate its memory usage with other threads. This doesn't mean it won't work, it just means that you can't GUARANTEE it. Threads often interact in surprising and unexpected ways, and this can create some very strange problems that depend on the phase of the moon and are difficult to track down.
PHP itself is thread safe (that's what the Thread Safe Resource Manager is all about); if your extension use is limited, it should work fine in a threaded MPM.
A better solution IMO is to use FastCGI; mod_fastcgi is thread safe, and it seperates PHP (and pretty much any other language) from the webserver so you can't make the webserver blow up with a badly written script, as well as using fewer resources since there's no need for a 1:1 mapping between webserver processes and PHP processes. You can even host your PHP on a seperate machine, or a cluster of them, without having to manage webservers on them all.
Has anyone done any benchmarks I've missed that show apache-httpd is actually faster using threads, for real platforms? Yes, I realise win32 requires them... I don't care.
Any noticable speed loss is unlikely; that you need fewer PHP processes and database connections eating memory could actually make it faster.
There's no need for #! lines in your.php files; the interpreter loads whatever SCRIPT_FILENAME is set to by the webserver. With external servers you don't even need the.php's to be in the webserver's document tree; your PHP interpreter(s) can be running in a seperate part of the filesystem, a chroot jail or even a seperate server; even load balanced across many servers using something like the pen load balancer or lighttpd and its native lb support.
Not necessarily the simplest or most sensible setup for small sites/development, but it works well in more loaded setups.
I use something called turck-mmcache as a php accelerator, would this also work with mod_fastcgi ? php runs very slowly without this accelerator active..
It is because of your comment. Now that you have drawn attention to the fact that this is the least commented story, readers are tentative (myself included) to post new comments for fear of ruining this new record;)
"This version of Apache is principally a bug fix release.
This release is compatible with modules compiled for 2.0.42 and later versions.
We consider this release to be the best version of Apache available and encourage users of all prior versions to upgrade."
Just finished upgrading:)
Looking back at the story history for Apache, it makes you wonder why it's even a section. A quarter or so of the stories have been just Security fixes and minor releases. Although I guess when you're looking for stability, that's a plus.
Apache 2 and PHP (Score:5, Informative)
A: Yes, but only if you use the (default) Apache prefork module with PHP. Some libraries used by PHP are not thread-safe, so you cannot use the multiple thread model.
For details on using Apache 2 and php see my FAQ at http://dan.drydog.com/apache2php.html
Re:Apache 2 and PHP (Score:1)
Re:Apache 2 and PHP (Score:2)
Re:Apache 2 and PHP (Score:5, Interesting)
A better solution IMO is to use FastCGI; mod_fastcgi is thread safe, and it seperates PHP (and pretty much any other language) from the webserver so you can't make the webserver blow up with a badly written script, as well as using fewer resources since there's no need for a 1:1 mapping between webserver processes and PHP processes. You can even host your PHP on a seperate machine, or a cluster of them, without having to manage webservers on them all.
Re:Apache 2 and PHP (Score:2)
Has anyone done any benchmarks I've missed that show apache-httpd is actually faster using threads, for real platforms? Yes, I realise win32 requires them ... I don't care.
Re:Apache 2 and PHP (Score:1, Informative)
--Martiner
Re:Apache 2 and PHP (Score:2)
Re:Apache 2 and PHP (Score:5, Informative)
There's no need for #! lines in your
Not necessarily the simplest or most sensible setup for small sites/development, but it works well in more loaded setups.
Re:Apache 2 and PHP (Score:2)
Re:Apache 2 and PHP (Score:2)
Re:Least Commented Story (Score:5, Funny)
"This version of Apache is principally a bug fix release.
:)
This release is compatible with modules compiled for 2.0.42 and later versions.
We consider this release to be the best version of Apache available and encourage users of all prior versions to upgrade." Just finished upgrading
Re:Least Commented Story (Score:2, Insightful)
Interesting Snippets from the Changelog (Score:3, Insightful)
- Add a build script to create a Solaris package.
- (null)
- (null!)
(Changelog [apache.org])
Well, at least Apache now supports Open Solaris!