Failed to restart Firebird with PHP

1

I have a virtual server with Linux-Debian operating system, the same is configured as Nginx Web server and Firebird database. I have a script that performs a Firebird restart routine and runs it when a crash occurs. My script, which is located at: '/scripts/restart_firebird.sh' I can usually run it via SSH. There was a need to put the script to run through a request through a PHP script. The command used is:

$output = shell_exec("/scripts/restart_firebird.sh");
echo $output;

When I run, I get the message:

  

Stopping Firebird 2.5 superclassic server ... failed.

I checked the firebird log files located in '/ var / log' but this error is not being logged.

Script content sh:

  

service firebird2.5-superclassic restart

    
asked by anonymous 30.12.2016 / 19:27

1 answer

1

The simplest way to run a script the way you need it is by using visudo . But see this is just one way, I suggest you better understand how permissions work on Linux, and using visudo incorrectly can cause security issues on your server.

$visudo

It would be as below, will allow execution without asking for password:

www-data ALL = NOPASSWD: /scripts/restart_firebird.sh
    
30.12.2016 / 20:52