Hi everyone,
Please assist with this issue that I'm having. I am trying to create a simple web interface to allow me to send sms's from a browser window. I am using gammu (http://wammu.eu/). I am able to execute the code below when using the php cli on the linux box. But when I run the script from a browser, the sms application is unable to access the configuration file which is actually given by the directive -c /var/www/html/gsms.
I have tried adding the apache user to the sudoers file with the rights to execute the program, but I keep getting the error that Failed to read config: Can not open specified file. , which is the error that the program throws when it can't find a configuration file.
Anyone with an idea on how to solve this? Please see code below.

//This is a test script for sms sending via web interface
/*$comhandle=exec("/usr/local/bin/gammu-smsd") or die("Could not execute command");
echo $comhandle;*/

//print system('dir');

/*$content=system('cat gammu-smsdrc');
echo $content;*/
$arg1='/usr/local/bin/gammu-smsd -c /var/www/html/gsms';
//$arg2=' -c';
//$arg4=' /var/www/html/gsms';
$output=shell_exec($arg1 /*.$arg2.$arg3*/) or die("Could not execute command");
echo "<pre>".$output."</pre>";

5 Years
Discussion Span
Last Post by c-tech

Hi everyone,
I've been able to crack the problem. It turns out that you have to allow the web server user, in my case it's apache, to be able to write the logs for the sms application. phew!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.