I have a free webspace hosted by altervista where i have one script python and one script php. What i want to do is call the python script using the php script. I googled for a solution and i found several questions about it, i tried different proposed solutions but no one worked for me.
Here the php script code:
<?php
$command = escapeshellcmd('test.py');
$output = shell_exec($command);
echo $output;
?>
and here the python script code:
print("Hello")
When i run the php script nothing happens. What's wrong?
Thanks
-
3Have you tried "python test.py" instead? Also, does your host even support python scripts to be called?Manuel Mannhardt– Manuel Mannhardt2018年02月12日 15:21:00 +00:00Commented Feb 12, 2018 at 15:21
-
i already tried it but it doesn't workxXJohnRamboXx– xXJohnRamboXx2018年02月13日 09:17:27 +00:00Commented Feb 13, 2018 at 9:17
1 Answer 1
Your hosting company might have disabled the shell-exec function for security reasons. I'm not saying it is the case, but you should check that first before even trying to run shell_exec.