0

I have node js file that is running a python script. But I want to run the python script in a php file. Can anyone help me with it? I want to know the ways that don't use the functions like exec() or shell_exec() or so...

J.Ares
  • 48
  • 1
  • 9
  • 5
    Possible duplicate of [Running a Python script from PHP](https://stackoverflow.com/questions/19735250/running-a-python-script-from-php). http://idownvotedbecau.se/noresearch/ – Nic3500 Jun 11 '18 at 11:27

1 Answers1

1

Running a Python script is very similar to running a binary. There are many options, the simplest one:

http://php.net/manual/en/language.operators.execution.php

`python path/to/script`;

Few there are other function to look at:

  • exec
  • shell_exec
  • system
  • passthru

http://php.net/manual/en/ref.exec.php

Michas
  • 8,534
  • 6
  • 38
  • 62
  • if all those functions are disabled for security reasons, then how can I do? – J.Ares Jun 11 '18 at 11:28
  • 1
    If those function are disabled, You cannot. I am afraid. Someone has configured PHP to not execute external programs or scripts. – Michas Jun 11 '18 at 11:43