PHP Execution Model
Discussions focus on PHP's server integration (mod_php, PHP-FPM) versus CGI, highlighting its stateless request handling, performance advantages, and lack of app servers compared to frameworks like Ruby on Rails or Python.
Activity Over Time
Top Contributors
Keywords
Sample Comments
This is basically what PHP is. PHP can be deployed in several ways, CGI, FCGI or as threaded module in apache, but that rarely matters from the perspective of the programmer, the code will work the same regardless what you put in front of it but still keep CGI-like execution. This is why PHP is a perfect match for the web.
PHP integrates with the server. It does not have the spawn a new process per request like CGI
PHP can only be used serverside, no? Can't write single page apps.
Nobody runs PHP in CGI mode, either they go with libapache2_mod_php, where Apache itself does the work or PHP-FPM with Nginx.Either way you are not going to pay for the PHP process startup cost.PHP can also cache the interpretations of files so you avoid that cost as well.And frameworks usually have their own usually file-based caching mechanism.At the end of the day it's still going to have some costs compared to a single application server model, but for most web apps it'
cause PHP isn't magic like Ruby on Rails.
This doesn't seem to replace PHP whatsoever.I thought PHP didn't run as CGI, shelling to a separate program with every request. It runs, in nearly all installations, as a plugin, saving the overhead of spawning a new program.That's just one of the many reasons it did so well back it the day because it allowed a server to handle far more requests than CGI based stuff.
Php needs an application server as well.
PHP is much better than CGI, because it doesn't have to load an interpreter and all libraries per request -- they were loaded at server startup time. This is why all serious web frameworks don't use CGI. But PHP avoids the administrative/stability problems of persistent servers -- Python, Java, Ruby -- by disallowing state across requests.I think, because PHP servers are so stable, that's part of why they're so common on shared web hosts. For example, running a WSGI server is much m
Maybe they use PHP like a better version of server side includes. For this RoR is probably an overkill.
No, but PHP does not get in your way unlike many other web frameworks.