exec - Execution of DalekJS with PHP does not work -
i use testing framework dalekjs test user interface. execute testing script mytest.js type shell:
cd /applications/xampp/xamppfiles/htdocs/tests dalek mytest.js
and works fine. execute same script php. code:
<?php chdir('/applications/xampp/xamppfiles/htdocs/tests'); $command = 'dalek mytest.js'; exec($command, $return, $return_var); var_dump($return); var_dump($return_var);
running php-script in browser, prints:
array(0) { } int(127)
the dalekjs script generates screenshot when executing in shell running php not happen anything. have tried shell_exec(), system() , passthru() without success. have idea why php script not work?
calling dalek php works fine me. possible php process running different environment (containing path
, amongst other things) user? maybe apache user or such?
<?php // change current working directory of current php process, // subsequently change initial cwd of exec() $wheremytestsare = __dir__; chdir($wheremytestsare); // locate dalek $dalek = exec('which dalek'); // abort if there no dalek, // may want check path or supply full path if (!$dalek) { echo "could not find dalek executable, please check path"; $path = exec('echo $path'); echo '$path ', $path, "\n"; exit(1); } // relative $wheremytestsare // exec() blocks until child process (dalek) exits exec('dalek mytest.js');
Comments
Post a Comment