0

Possible Duplicate:
Is PHP compiled or interpreted?

I am little confused with the words used with PHP. I know PHP is a scripting language. Some times I read it is interpreted or some time it is compiled!

How?, Is it something to do with when it is installed as Apache module it is compiled and if it is installed as CGI then it will be interpreted... But I know someone use to tell me that PHP is interpreted language too...

I may sound stupid but Currently, I am quite confused .I am quite aware of difference between compiler and interpreter.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user269867
  • 3,266
  • 9
  • 45
  • 65

2 Answers2

2

Typically, PHP is an interpreted language. The script is read and evaluated at run-time by the interpreter. It is not pre-compiled into a different form.

There are PHP compilers, some which actually compile them, and some which just package/obfuscate the script along with the interpreter into a self-standing executable.

Related question about Zend Engine (actual compiler): How zend engine compile php codes or How php compiler works?

Related product, open source PHP compiler (makes an executable, obfuscates php, includes interpreter): http://www.phpcompiler.org/

Community
  • 1
  • 1
Fosco
  • 38,138
  • 7
  • 87
  • 101
  • does it mean that we use both interpreter and compiler...my php script is interpreter ed and internally the same script is also compiled ? I am sorry if I make no sense... – user269867 Jul 08 '11 at 05:37
  • You don't normally use both. Your script is interpreted, period. As I mentioned, there is at least one option (Zend) which *can* compile it, but it's not typical or necessary in any way. – Fosco Jul 08 '11 at 12:56
1

The PHP is an interpreted language. The binary that interprets PHP is compiled, but the code you write is interpreted. Check the wiki page on PHP

Balanivash
  • 6,709
  • 9
  • 32
  • 48