WN

WN (https://www.wn.se/forum/index.php)
-   Serversidans teknologier (https://www.wn.se/forum/forumdisplay.php?f=4)
-   -   Hur kör jag ett Python-script via PHP? (https://www.wn.se/forum/showthread.php?t=1065235)

Kimppa 2015-07-20 20:26

Hur kör jag ett Python-script via PHP?
 
Hej!

Sitter och kliar mig i huvudet. Har letat i ungefär en timme nu men lyckas
inte få mitt Python-script att fungera.

helloworld.py
http://torvanger.com/cgi-bin/helloworld.py

Man kommer åt filen i webbläsaren, men allt skrivs ut som text.

Använder mig av CityNetwork. Kan det vara att Python inte stödjs?

Försöker starta Python-scriptet med PHP - men det går inte heller:

PHP-kod:

$output shell_exec("cgi-bin/helloworld.py")
echo 
$output

Någon som har nå tips?

oskarh 2015-07-20 20:29

Testa att skriva python cgi-bin/helloworld.py

CotopaXi 2015-07-20 21:02

Vad du än försöker göra: You're doing it wrong.

nim 2015-07-20 22:57

php and long running processes:
http://symcbean.blogspot.se/2010/02/...processes.html

epik 2015-08-07 13:04

PHP-kod:

$output shell_exec('/usr/bin/python helloworld.py');
echo 
"$output"



Alla tider är GMT +2. Klockan är nu 01:34.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson