ksweb打开php,如何在Android上使用ksweb+app从PHP运行Python?
我在我的Android手機上(我沒有PC)用lighttpd、nginx或apache服務器運行PHP、MySQL和ksweb+app。我想使用PHP exec或shell exec函數從localhost運行Python。我已經試過以下腳本:
你知道嗎測試.php文件:if(function_exists('exec')) {
echo "exec is enabled
";
}
$response = exec("python test.py"); // and with shell_exec
// $response = exec("python /sdcard/Python/test.py"); // also tried this and with shell_exec
// $response = exec("/usr/bin/python3 /sdcard/Python/test.py"); // also tried this and with shell_exec
// $response = exec("/usr/bin/python /sdcard/Python/test.py"); // also this one and with shell_exec
var_dump($response);
?>
你知道嗎測試.py文件類型:#!/usr/bin/python3
print("Hello World!");
如果我跑了測試.php每次顯示時:exec is enabled
NULL
但是如果我使用termux(比如:$php -S 127.0.0.1:8080 -t /sdcard/Python/)運行localhost并再次測試測試.php從localhost("Hello World!"。如果我跑測試.py來自SL4A應用程序。你知道嗎
最后我了解到termux有Python(on/data/data)/com.termux/files/usr/bin文件文件夾)。但是ksweb+沒有,因此我不能從PHP執行Python。你知道嗎
所以我的問題是:I can install Python on /sdcard/Python folder or /data/data/com.ksweb folder by termux or another way? How can I do that?
or How can I use exec/shell_exec from ksweb+ localhost with PHP?
or there are any way to migrate or link sl4a with localhost for run Python from PHP?
我想你理解我的問題。請幫幫我。你知道嗎
謝謝你。你知道嗎
總結
以上是生活随笔為你收集整理的ksweb打开php,如何在Android上使用ksweb+app从PHP运行Python?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vcpkg安装msys2
- 下一篇: 桌面文件太多?这个神器一键整理只需三秒!