I'm trying to make run a SMS sending python script from PHP.
SendSMS.py:
#!/usr/bin/env python
import gammu
sm=gammu.StateMachine()
sm.ReadConfig()
sm.Init()
message={
'SMSC':{'Location':1},
'Text':'blah blah bllah',
'Number':'xxxxxxxxx
}
sm.SendSMS(message)
when i run it from the terminal with "sudo" it doesnt work.But works fine without "sudo"
the error:
gammu.ERR_DEVICENOTEXIST: {'Text': u"Error opening device, it doesn't exist.", 'Code': 4, 'Where': 'Init'}
I want to run the SMS script from a php script using shell_exec(). The problems are:
I cant run the SMS script with sudo
I cant run it through php without sudo
Please tell me how to fix this
Device-Raspberry pi 3
OS- Raspbian