Roberto
Roberto

Reputation: 5

Error trying to send sms by php

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.

Upvotes: 0

Views: 1803

Answers (2)

Don Globian
Don Globian

Reputation: 76

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

Upvotes: 0

Michal Čihař
Michal Čihař

Reputation: 10091

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.

Upvotes: 1

Related Questions