**I have tried permissions but still getting this error
Array ( [0] => sh: 1: /var/www/nodejs/tmp: Permission denied )
The command is execute from the route file of Laravel(MVC PHP Web application)
Tried CHMOD 777 , CHMOD +x etc.
My current permission is as follows
-rwxr-xr-x 1 root root *number* Oct 9 21:35 test.js
What did i not do?
My php code
$user_input = "http://google.com/";
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
exec('/var/www/nodejs/tmp test.js $user_input 2>&1',$output);
print_r($output);
Your test.js may be a script
In that case make sure the interpreter is also executable
another possibility is that your file is on a filesystem with no execute permissions
If test.js
resides in directory /var/www/nodejs/tmp
, they are not to be separated by space, but joined by slash:
exec('/var/www/nodejs/tmp/test.js $user_input 2>&1', $output);