I've got a simple localhost website with a php page that has some buttons on it that call python scripts.
I can run it locally and the output works so standalone the scrip is fine. The issue is with the import function. Whenever I add an import, it breaks
I had it workining on an older laptop with a previous PHP and Python version.
Any thoughts
Here is the php
<?php
$command = escapeshellcmd("/usr/bin/python3 test-py.py");
$output = shell_exec($command);
echo $output;
?>
here is the simple python whois to a output file
import sys
import whois
if len(sys.argv) != 2:
print("Usage: python whois_ip.py <ip_address>")
sys.exit(1)
ip_address = sys.argv[1]
w = whois.whois(ip_address)
with open("output.txt", "w") as f:
f.write(str(w))
print("WHOIS lookup results written to output.txt")
My questions are 1 Any thoughts why the import function no longer works? Could it be a permissions issue with importing libraries? 2 My PHP.ini has disabled_functions = "" (so nothing is disabled right?) 3 Is there something special about PHP 8.2.5 and Python 3.9.6 that I should be aware of?
Appreciate any and all help on this. Thanks