Search code examples
phpexecassimp

is it possible to run assimp commandline tool with the php


I used following command to convert the 3d models with the assimp Assimp, and it is working fine on Windows:

assimp2json seaknight.obj seaknight.json 

I need to know how can I run this command from the PHP? I know that there re functions to run the shell execution from PHP, but it didn't work and I don't get any error.

PHP code is used is follows.

system("D:\assimp2json-2.0-win32\Release\assimp2json.exe assimp2json seaknight.obj seaknight.json");

and another one is

$old_path = getcwd();
chdir('D:\assimp2json-2.0-win32\Release');
$output = shell_exec('assimp2json.exe assimp2json seaknight.obj seaknight.json');
chdir($old_path);

Solution

  • Found it myself

    working code is below

    $old_path = getcwd();
    chdir('D:\assimp2json-2.0-win32\Release');
    $output = shell_exec('assimp2json monster.blend monster.json');
    chdir($old_path);
    

    no need to include the .exe, after remove it the command worked