I have a PHP script that should run a Python script, what i try. Nothing seems to work. I gived the script and the PHP script full permission (777). The way that i use to execute my Python script in php is:
<?php
shell_exec('python /var/www/html/send.py');
system('python /var/www/html/send.py');
?>
I tried a couple of methodes that are in the code above, but nothing seems to solve the issue. The strange thing is that the command is working fine when i execute it in Putty. So i don't know what could be the problem. The permissions must be right.
I found a few ways on Stack Overflow, but nothing has the same issue as me. This is the code that should be executed:
#!/usr/bin/env python
import sys #import sys
import serial #import Serial
import time
ser = serial.Serial ("/dev/ttyS0") #Open onze poort
ser.baudrate = 9600 #Baudrate instellen
adres = 2
data = 1
print adres #Debug Info
print data #Debug Info
byte = chr(int(adres)) # Omzetten adres naar Byte
ser.write(byte) # Uitsturen van adres over Serieeel
time.sleep(0.5) # Wachten (Atmel kan sloom zijn)
byte2 = chr(int(data)) # Omzetten data naar Byte
ser.write(byte2) # Uitsturen van data over Serieeel
ser.close() # Seriele poort sluiten