0

I have found a very similar question here. However, it did not help me to resolve my problem.

Using a web server I am trying to call a python script from a php script. However, when I import the numpy library I only get a blank screen while I get the expected output 'help' without the 'import numpy' line. Notably, there is no issue when running it through a terminal instead of web server.

php script:

<?php
  $input = 'help';
  $output = exec("/usr/bin/python3.5 /path/test.py '$input'");
  echo $output;
?>

python script (here I have commented out an attempt to throw an error, but all I get is 'PATH':

import sys
# try: 
    # import numpy
    # print('done')
# except Exception as e:
    # print(e)

import numpy
foo = sys.argv[1]
print(foo)

Any help would be much appreciated.

Christian
  • 991
  • 2
  • 13
  • 25

0 Answers0