我剛剛遇到問題,我正在使用webhook for github(我在php中寫了一個)。從php服務器重新啓動我的nodejs應用程序(與pm2)
的問題,我想從我的PHP代碼類似的東西重新啓動我的PM2應用的NodeJS:
shell_exec("pm2 restart test");
,但我的用戶:www數據(Nginx的)無法執行它。當我嘗試登錄爲WWW的數據,我得到這個:
Error: EACCES, permission denied '/.pm2' at Error (native) at Object.fs.mkdirSync (fs.js:747:18) at Object.CLI.pm2Init (/usr/local/lib/node_modules/pm2/lib/CLI.js:40:8) at Object. (/usr/local/lib/node_modules/pm2/bin/pm2:21:5) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16)
而且我不希望使用「命令」,因爲它不是真正乾淨,你有一個想法?非常感謝您提前:) :)