I'm trying to execute a nodejs file from php on a Centos server. When the command is executed from the terminal it works fine (also after switching to apache user with the following command su -s /bin/bash apache), but when the code is executed while browsing the file it throws the following exception:
["","","#","# Fatal error in , line 0","# Check failed: SetPermissions(protect_start, protect_size, PageAllocator::kReadExecute).","#","#","#","#FailureMessage Object: 0x7fffd9b37760"]
- I have changed also to absolute path, but no luck.
- Gave 777 permission to index.js file.
- Testet from terminal and works fine:
php -r 'echo exec("/usr/bin/node /var/www/html/index.js /var/www/html/source_files/ 2>&1");'
<?php
try {
exec("/usr/bin/node /var/www/html/index.js /var/www/html/source_files/ 2>&1", $out, $err);
if ($err == 0) {
return 1;
} else {
return 0;
}
} catch (Exception $e) {
error_log($e);
return 0;
}
?>