Home » Php » What is and where is the runtime environment for 'PHP' like the 'Node.js' runtime environment for 'Javascript' to build server-side web applications?

What is and where is the runtime environment for 'PHP' like the 'Node.js' runtime environment for 'Javascript' to build server-side web applications?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m a PHP Developer by profession and I’ve never used Node.js in my life.

But I know that Node.js is a cross-platform JavaScript runtime environment that allows developers to build server-side and network applications with JavaScript.

The above statement created one query in my mind that like Node.js is there any runtime environment exist for the server-side programming language PHP?

I’ve never heard that PHP also has a runtime environment which I always hear in case of Javascript which has Node.js as a runtime environment to build server-side web applications.

Someone please clear my doubt in case of runtime environment for PHP. If it’s present where it is and what it comprises of? If not, then explain how does PHP allow to build server-side applications without having a runtime environment?

Following is my current setup for PHP :

I’m using PHP 7.4.2 on my laptop that runs on Windows 10 Home Single Language 64-bit operating system.

I’ve installed the latest version of XAMPP installer on my laptop which has installed the Apache/2.4.41 (Win64) and PHP 7.4.2

How to&Answers:

I’m not sure to understand yours questions, but i’ll try to answer you properly.
As en interpreted language I think PHP could not be considered to have runtime environment.

I’ll assume by runtime environment you may reference to a complete environment isolated from the other part of the system( like Java VM)

You can use generally PHP in two main ways:
– with a web server (websites, web apps..)
– a standalone executable (CLI scripts)

  1. With a web server, you can not assume this a runtime environment as it come separately: webserver + php module for this webserver

  2. As a standalone executable, you may have environment variables and others configurable environment elements related but this not isolated from the rest of the operating system:

    • It doesn’t execute is own bytecode (however you could use OPCache
    • It doesn’t manage it own threads : same as above you can use extension

    It’s complety différent from NodeJS which use a VM(V8) from my point of view.