Running Ionic-CLI using PHP's shell_exec()


Hey guys, has anyone managed to successfully get PHP’s shell_exec() to successfully run an Ionic-CLI command? Essentially, when I run the following:

shell_exec(“ionic -v 2>&1”);

I get the following result:

path.js:8 throw new TypeError('Path must be a string. Received ’ + ^ TypeError: Path must be a string. Received undefined at assertPath (path.js:8:11) at Object.posix.join (path.js:479:5) at new IonicStore (/usr/local/lib/node_modules/ionic/lib/ionic/store.js:17:26) at Object. (/usr/local/lib/node_modules/ionic/lib/cli.js:6:19) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

It works perfectly from the command line, and this occurs with any command. Any ideas? Hopefully someone’s done this before and it’s an environment issue on my end.


I still have yet to find a solution for this. Surely I’m not the only person who’s ever tried to do this.