I was reading an article/interview (Language War: PHP vs. Ruby (by Jeffrey Way; Mar 2011)) by a developer for Envato using Ruby. He says, "PHP is a web framework disguised as a language."

He didn't expound on that statement, so it got me wondering if that is true, and if so how. I did a bit of research but couldn't turn up any information on this topic. I'm wondering how this statement is true and what makes PHP not a programming language. And why do other languages like python or ruby not fit in that category?

  • 2
    This is going to provoke too many purely opinion-based answers, flagging to close. Jul 16, 2013 at 3:59
  • 4
    @DeerHunter How do you know there wont be someone with some actual knowledge and sources to back up what he says? This is a valid question that I'd like to know more about from somebody who has more knowledge than me.
    – jordan
    Jul 16, 2013 at 4:02
  • 7
    Sorry if it comes across as harsh; PHP is Turing-complete, ergo it is a programming language. Everything else is opinionated. Jul 16, 2013 at 4:06
  • 2
    You could argue it's not "just" a programming language.
    – JeffO
    Jul 16, 2013 at 12:06
  • 2
    PHP is an incredibly bloated HTML templating engine. Jul 16, 2013 at 17:30

5 Answers 5



PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

According to http://us.php.net/

But that isn't necessarily a very apt description.

PHP is a Turing complete computer language. However any distribution of PHP is going to come with a huge number of standard libraries, so much so that the standard PHP libraries could be classified as a framework.

Therefore, when looked at in this way, PHP is either:

A framework with its own unique Turing complete scripting language.


A language wrapped in a massive web-framework, from which it can not be removed.

However if we look at the name "PHP: Hypertext Preprocessor" (PHP), this implies that PHP is a "Preprocessor" (that preprocesses Hypertext) - neither a framework, nor a language, but a piece of software.

When you look at it that way, PHP is an application that runs scripts in a proprietary language, with access to a large internal framework designed to process Hypertext.

Therefore: PHP can not properly be classified as either a framework or as a language. The truth is that there is a language, a framework, and an application, that all have the same name (because they are all rolled into one thing)! Thus "PHP" can refer to any part of the system.

  • I don't believe the PHP is proprietary - there are numerous implementations of the PHP language, and the language itself is open source, though some Zend code is closed. Jul 16, 2013 at 11:12
  • +1 but with a remark: PhP started out as a library, a set of functions to help with the interaction between http server requests and the actual program
    – Pinoniq
    Jul 16, 2013 at 13:09
  • "A language wrapped in a massive web-framework, from which it can not be removed." - Why not? You can run (and people are running) PHP outside of the SAPI. The rest of the answer is very solid though. Jul 16, 2013 at 18:04

I don't have sources - but the statement makes some sense, even if it might just be an attempt to stir controversy.

PHP is definitely a language, and very much not a framework - but if you look at the PHP manual versus, say, the C or C++ specification, the body of functionality that PHP offers has elements that would be considered in the domain of a framework: PDO, XML handling, and so on - this stuff is what would normally be included in a framework like Qt.

  • 4
    It's a veritable plethora of functions. Jul 16, 2013 at 4:28
  • 1
    Having a standard library doesn't make a framework. Inversion of control makes a framework. Jul 16, 2013 at 7:58
  • 1
    I didn't say it was a framework - just that it has elements more traditionally associated with frameworks. IoC is another, important, element of frameworks, but I wouldn't say it is the one defining feature.
    – HorusKol
    Jul 16, 2013 at 8:31
  • 1
    @RobertHarvey You're asking me what's the definition of a framework. A framework is a framework only if it has at least IoC. Jul 16, 2013 at 17:34
  • 1
    Q: Why the F would I want a framework to impose its garbage IOC implementation on me? A: I wouldn't.
    – rdlowrey
    Jul 16, 2013 at 18:04

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 ($_SERVER, $_GET, $_POST, $_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.


PHP is not a web language. Its has built in features to do programming in Web application. Developing a web application in PHP is very easy compared to other languages like java,ASP,C#.

If you want to develop a web application which is not so huge and uses database with less size (few GB's) ,then you can develop php web application. There are many web host companies which provide PHP based web hosting charging very less price with all the features.Maintaning a PHP site is less compared to Java/ASP. PHP is light weight web application.


Ryan is probably forming his opinion based on a historical perspective. Historically, PHP was meant to be a web language. Historically a lot of features in the language were designed for this use case, and in fact PHP used to stand for "Personal Home Page". http://www.nusphere.com/php/php_history.htm

But now, PHP has developed a lot and I would personally argue this isn't really true any more.

Just 2 examples:

Threads were only added to the language recently. For a long time, it just wasn't possible. Threads are something that don't make sense in a web environment (instead you tend to kick of a completely new background process or pass a message through a que to a worker elsewhere). http://uk3.php.net/manual/en/book.pthreads.php

Memory & Resource management. PHP provides a __destruct() method on objects, so you can clear up resources. But to start with, this was only called on script shutdown. Now in a web environment this makes sense because you only want your script to run 0.5secs at max, so script shutdown is never far away. But for a long running background or shell script this is terrible. Later versions of PHP fixed this. http://php.net/manual/en/language.oop5.decon.php

However, you will still generally tend to find PHP used in a web and server context and not a desktop app context - so this is where a lot of the focus is.

Not the answer you're looking for? Browse other questions tagged or ask your own question.