Closed yazer79 closed 4 years ago
Hi there, can you show what method you're using to start NickJS please?
Hi paps!
$proc = proc_open('node test.js', $in, $out);
One of the parameters of proc_open
is an array of environment variables to forward to the child process. It should work if you set CHROME_PATH this way.
Can't get it to work yet
$in =[];
$out = [];
$env = ["CHROME_PATH"=>"/usr/bin/chromium-browser"];
$cwd = getcwd() ;
$proc = proc_open('node test.js', $in, $out, $cwd, $env);
I don't mind using exec() or shell_exec() if they are more simple to follow putenv(). I hope I can learn more than one way
It's hard to tell what's going on. What error are you getting? I need more info to help :)
I finally got it! The env vars were loaded right, but the script was failing silently because of the script saving screenshot had no write permissions and I didn't notice that. Thanks a lot :)
Nice, glad to hear that :)
NickJs runs fine on Ubuntu after setting CHROME_PATH manually
$ export CHROME_PATH=chromium-browser
and running node from terminalHowever, I can't run it from PHP unless I execute node script from terminal manually. I want PHP to set the environment variables
putenv('CHROME_PATH=/usr/bin/chromium-browser');
This is not working. Any suggestions?