Uglify-JS won’t run using shell_exec()

My question is similar to this:

Nodejs – .node_libraries/ for www-data

I’ve been trying all night to get php to execute uglifyjs. I’ve tried:

die(shell_exec('NODE_PATH="/home/app/nodejs/node_modules/"; export NODE_PATH; uglifyjs -o /home/app/public_html/js/profile.min5.js /home/app/public_html/js/profile.js'));

and

die(shell_exec('node /home/app/nodejs/node_modules/uglify-js/bin/uglifyjs -o /home/app/public_html/js/profile.min33.js /home/app/public_html/js/profile.js'));

and a bunch of other crazy combinations but nothing works. Everything works fine if I do it manually in the shell. Can anyone help please?

Problem courtesy of: Yuriy

Solution

Have you tried looking at the following (I’ll go for the obvious since you haven’t said what you’ve already tried):

user apache/www-data is allowed access to /home/app : sometimes /home directories are closed off (chmod 0700)

Is safe_mode
on your server in effect? From the command line, try:

php -i | grep safe_mode

Then, look at the output of:

phpinfo();

Which version of PHP are you using (might well be irrelevant)?

Solution courtesy of: Michiel

稿源:Node.js Recipes (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Uglify-JS won’t run using shell_exec()

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录