0

I installed gammu in linux and I can send sms using the shell command. But when I add the command in a php page I get the following error:

$phone = 3588459717;

echo shell_exec ('gammu sendSms TEXT '.$phone.' -text "test msg"');

Error opening device, it does not exist.

Roberto
  • 5
  • 4
  • thank you, I copu the file .gammurc from user folder to php file folder as gammurc, give all permissions to this file, problem solved. – Roberto May 19 '15 at 11:50

2 Answers2

1

Most likely the web server is running as different user and Gammu running under this user does not see your configuration file and/or does not have permissions to open the device.

Michal Čihař
  • 9,799
  • 6
  • 49
  • 87
0

php process under apache Server, runs as a user with permission www-data:www-data try to ad permission, please start console as root user and add permission dialout to user www-data.

id www-data   
uid=33(www-data) gid=33(www-data) groups=33(www-data)

usermod -a -G dialout www-data

id www-data   
uid=33(www-data) gid=33(www-data) groups=33(www-data), 188(dialout)
sudo service apache2 restart

after apache restart, run your php script

Don Globian
  • 66
  • 1
  • 4