Reputation: 113
From Terminal this works just fine and returns what is expected:
/Users/me/Desktop/Clients/IM/apps/node_modules/.bin/mjml newslettercode.html
This also works just fine from Terminal
node node_modules/.bin/mjml newslettercode.html
This also works just fine from Terminal
node_modules/.bin/mjml newslettercode.html
Im running MAMP & domain as my development.
From my .php file in my browser i get exec() error 127 and no output.
This test code:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
define('ROOT_DIR', realpath(__DIR__.'/..'));
$file = ROOT_DIR.'/apps/node_modules/.bin/mjml newslettercode.html';
exec($file, $output, $responseCode);
print_r ($file);
echo "<pre>";
print_r($output);
echo "</pre>";
echo "<pre>";
print_r($responseCode);
echo "</pre>";
Returns this:
/Users/me/Desktop/Clients/IM/apps/node_modules/.bin/mjml newslettercode.html
Array
(
)
127
Im assuming that Node is not running on My MAMP Host? im not sure.. any help would be appreciated.
Upvotes: 3
Views: 1869
Reputation: 1029
The problem Was in path of the aplication php can't find the application by using just node /../..php
try to use the command bellow should make the work :
@HamzaNig : /usr/bin/node mostly is the default path
@Joe : /usr/local/bin/node is the default path on his platform
Upvotes: 2