cztomczak / phpdesktop

Develop desktop GUI applications using PHP, HTML5, JavaScript and SQLite

Home Page:https://groups.google.com/d/forum/phpdesktop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.JS

DocBitSchubser opened this issue · comments

Is it possible to install Node.JS under PhpDesktop? If so what is the best way to realize this.

Unfortunately not. It's configured under apache, you'll need something else. Try Electron.

This questions seems a lot weird.
Why would you want to install nodejs with PHP?
Doesn't make sense, since both technologies are server side processors. You either choose php or nodejs to process things.

If by, some reason, you need to install nodejs, you can make a php script that downloads nodejs and asks user to execute the installer (permission to install). But this would be a lot weird too;

I have to agree. Also if you want to use Node.JS then maybe you really want to be using Electron instead.

It's not weird to me because I have done it once before. If you are looking to build a desktop app with NodeJS, you have to use Electron. But I understand that electron doesn't work like the conventional server-client routing many of us are used to. That's why we all love phpdesktop, we can write our ajax calls on desktop applications! If you must use phpdesktop, then you have to download NodeJS and save its files somewhere in phpdesktop preferably close to php folder. Now save the path of node.exe in the environment variables path. Then open a terminal, run node -v, if you get something like 14.2.1, then Nodejs is actively ready for use. You can now write NodeJS scripts and then call them in your PHP scripts with the function shell_exec. For instance, shell_exec("node switch-bluetooth"), in this case my NodeJS script is switch-bluetooth.js. I have used it once before and it works surprisingly fine.

Looks like this was answered. If @mkoakintomiwa you would like to put this answer to Knowledge Base wiki page feel free.