Based on your statements, Electron might be worth checking out. It will work on all platforms, and you could build it just like a web app with HTML and CSS and call the Google API just like in the browser with node-fetch. PHP is a server-side scripting language, so probably won’t work well in this use scenario.
Running the commands in Electron doesn’t seem to be too big of a problem. You have access to all NodeJS libraries, and you could also try shelljs
This is assuming you want to build a traditional desktop application with a user interface.
So for this, you are going to want to create an API microservice you can run on your web host. I suggest using Node if you want to create a desktop app (that way the front and back end would be very similar), but if you know how to create a REST api in PHP, then go for it.
Be careful that you don’t allow users to type their own commands as they could easily inject a malicious command into your server. For example, say you just wanted to have them call the ping command for a url (obviously contrived example):
assuming google.com is what you received from them. They could easily just append another command on there to do whatever they wanted, i.e.
ping google.com&&rm -rf some_folder