The reason is historical.
PHP
PHP was born to provide a simple way to create dynamic web pages. In 1994, this would mean either:
- Implement your own server, which means spending months doing tedious and complex work,
- Or use CGI and rely on an existent web server with CGI support, such as NCSA httpd.
It is not surprising that, given the original goal of PHP, Rasmus Lerdorf decided to go with the second option, which led PHP to be compatible with the successor of NCSA httpd—Apache. Since then, PHP remains Apache-friendly, as much as LAMP stack is among the easiest things to set up for a beginner programmer.
PHP was always a language, and nothing more. It is not a web server, and wasn't intended to be a web server; instead, it relies on a web server as its primary execution vector.
Node.js
Things were very different for Node.js. In 2009, Node.js was born as a reaction to the existent servers, including Apache:
Dahl criticized the limited possibilities of the most popular web server in 2009, Apache HTTP Server, to handle a lot of concurrent connections (up to 10,000 and more) and the most common way of creating code (sequential programming), when code either blocked the entire process or implied multiple execution stacks in the case of simultaneous connections.
Source: Wikipedia.
In this context, one would hardly make Node.js rely on Apache server (or IIS, or whatever). The processing model of Node.js is substantially different, which makes it impossible to integrate with WSGI or CGI.
If PHP is a language, Node.js is not. Node.js is a runtime environment which allows to run JavaScript outside the context of a browser. This makes Apache a competitor of Node.js. Does it surprise you that IIS doesn't need Apache to run?
Python
Python is very like PHP. The SimpleHTTPServer you mention in your question is not intended to be used in production, so you end up hosting your application in either Gunicorn or Apache (or another server, depending on your preferences), exactly like you do with PHP.
Same logic here: writing a complete HTTP server is not an easy task, and also quite unnecessary: since most system administrators are familiar with Apache, why creating something new, when you can simply make Python WSGI-compatible?
php -S
and also-t
, php.net/manual/en/features.commandline.webserver.php