Is PHP compiled or interpreted?
Answers
Here's what worked best for me when trying to script this (in case anyone else comes across this like I did):
$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>
The -d php_suffix=<version>
piece allows you to set config values at run time vs pre-setting them with pecl config-set
. The uninstall -r
bit does not actually uninstall it (from the docs):
vagrant@homestead:~$ pecl help uninstall
pecl uninstall [options] [channel/]<package> ...
Uninstalls one or more PEAR packages. More than one package may be
specified at once. Prefix with channel name to uninstall from a
channel not in your default channel (pecl.php.net)
Options:
...
-r, --register-only
do not remove files, only register the packages as not installed
...
The uninstall line is necessary otherwise installing it will remove any previously installed version, even if it was for a different PHP version (ex: Installing an extension for PHP 7.0 would remove the 5.6 version if the package was still registered as installed).
Go and read the answers to this question
https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design
The answer I accepted is excellent and should help answer your question.
For me personally, I am somewhat cautious of the idea of calling a language interpreted or compiled. It's an implementation decision, not part of the language specification. If you want to talk about compiled or interpreted JavaScript, ask it in the context of an actual implementation of the language specification.
Clojure is always compiled.
The Clojure compiler produces Java byte code, which is typically then JIT-compiled to native code by the JVM.
The thing that can be confusing is the dynamic and interactive nature of Clojure that means you can invoke the compiler at run-time if you want to. This is all part of the Lisp "code is data" tradition.
For example, the following will invoke the Clojure compiler at run-time to compile and execute the form (+ 1 2)
:
(eval '(+ 1 2))
=> 3
The ability to invoke the compiler at run-time is very useful - for example it enables you to compile and run new code in the middle of a running Clojure application by using the REPL. But it's important not to confuse this "interactive" style of development with being "interpreted" - Clojure development is interactive, but still always compiled.
Never used any of those, but they look interesting..
Take a look at Gearman as well.. more overhead in systems like these but you get other cool stuff :) Guess it depends on your needs ..
A compiled code can be executed directly by the computer's CPU. That is, the executable code is specified in the CPU's native language
The code of interpreted languages must be translated at run-time from any format to CPU machine instructions. This translation is done by an interpreter.
It would not be proper to say that a language is interpreted or compiled because interpretation and compilation are both properties of the implementation of that particular language, and not a property of the language itself. So,any language can be compiled or interpreted – it just depends on what the particular implementation that you are using does.
The most widely used PHP implementation is powered by the Zend Engine and known simply as PHP.The Zend Engine compiles PHP source into a format that it can execute, thus the Zend engine works as an interpreter.