The thing with PHP is that it's not just a programming language, but an entire ecosystem, consisting of:
- The PHP programming language itself
- A runtime that can hook into a web server (through
mod_php or CGI/FastCGI), and provides lots of ways to interact with it
- A large library of built-in functions and classes, many of them web related
PHP provides features in the language itself that are very specific to web programming, such as the superglobals (
$_COOKIE, etc.), jumping between PHP mode and HTML mode using
<?php ?> tags, etc., and its semantics are built around the one-process-per-request execution model that was the norm back in the early days of server-side web programming. PHP started out as a web scripting tool, and only evolved into a (somewhat) general-purpose programming language later; the CLI version and other non-web features, even though they can often be used quite effectively, are an afterthought, and with enough exposure to the language and its ecosystem, this can become painfully obvious at times.
By contrast, most other programming languages were designed as general-purpose, systems or application programming languages from the beginning, and anything specific to web programming comes in libraries. If you want to do web programming in, say, Python, you need a web framework, or at least a library to implement web server bindings and things like request parsing, HTML templating and session management, and probably some database bindings too (unless you're really hardcore and write all that from scratch).
PHP has all these things built into it by default, and that's why people like to say that PHP is a web framework in itself.
For a "Hello, world!" web application in Python, you'd typically set up a virtualenv, install some libraries, set up some boilerplate for the web framework, define routes, and write a handler that generates a response with "Hello, world!" in the body; in PHP, it's a matter of writing
<?php echo "Hello, world!" in index.php, copying it to apache's docroot, and enabling mod_php. The rest (hooking into the server, parsing requests, generating responses, etc.) still happens, but PHP takes care of it for you.