problems with exec php

Asked

Viewed 111 times

0

I made the following command in php

    $comando="C:\Python27\python.exe programa.py";
    echo $comando;

in the python file

    print resultado;

This result variable has content formed in json

    {
       "algumacoisa":"algumacoisa"
    }

When I do the command prompt:

    python.exe programa.py

It returns the contents correctly, but when I do with php

    php site.php

It only returns the last line of json which is only one

    }
  • I’m not very knowledgeable about exec php, but you tried with shell_exec?

  • shell_exec is for linux

  • I use shell_exec in windows, if you’re using php you probably can too

  • I figured it out, just using the passthru

  • passthru($command, $result); echo $result;

  • where I put that’s solved?

  • only leaves so, or else answers your own question with the answer you found and marks your answer as the correct one

Show 2 more comments

1 answer

0

Solved

It worked using the command

    passthru($comando, $resultado); echo $resultado;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.