I want to use uglifyjs (https://github.com/mishoo/UglifyJS) from my PHP application. UglifyJS is built using Nodejs, so I need a .node_libraries/ dir in my homedir (/home/peppe).
I want to execute uglifyjs by shell_exec() in PHP. But where am I supposed to add the .node_libraries/ dir since www-data user doesn't have a home dir?
Addition: I solved it. The solution was to set NODE_PATH and execute the command like this in PHP:
shell_exec('NODE_PATH="/opt/www_node_libraries/"; export NODE_PATH; uglifyjs options filename');
Quoting the OP and @Bill so we can get this removed from unanswered list.
Addition: I solved it.
The solution was to set NODE_PATH and execute the command like this in PHP:
shell_exec('NODE_PATH="/opt/www_node_libraries/"; export NODE_PATH; uglifyjs options filename');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With