2

I have been doing a lot of search engine search for past 7 days on how to do FFI with python but most examples are on using C or Rust and one example on using go lang but I do not see anyone going with Python but it is widely used one.

Can we use Python code to run via PHP FFI to process any data?

If yes, can you show a sample example of the same as I do not see a reference of it or presence of it only, this will be helpful of whoever else is searching on it.

sarathkm
  • 1,306
  • 1
  • 9
  • 11
  • 1
    You can run Python scripts using `system`, just like you could run any external command. You can't call individual Python functions within the PHP process. – Tim Roberts Nov 19 '22 at 01:27

1 Answers1

0

FFI enables you to run code from a shared library. As far as I know, you are not able to compile python code as a shared library, so no, you cannot use PHP FFI to run python scripts.

Vinicius Dias
  • 664
  • 3
  • 15