How restart asterisk using a php script on local page

Hi. I’m triying to make a web based configuration to asterisk and the only problem it’s that i don’t know how restart asterisk using php!!
I’m using apache server and i don’t know how use .agi scripts and perl scripts, i wanna do this just using php, I triyed put

<?php system('reboot'); ?> But, nothing happen

this others too

<?php system('service asterisk restart'); ?> <?php shell_exec('reboot'); ?>

How can i do this guys??

The user that runs the web server needs to have the permissions to run the commands you tried, I don’t think your webserver can reboot your server or start asterisk (because per default Asterisk runs as root and the webserver not).


Marco Bruni

The only possible way I could think of is to install apache with modified SuExec, so it’s possible to run CGI scripts as root.

That way you can write cgi/pl scripts to restart the Asterisk service as root.

Or use sudo; if you do this way pay much attention to sudo’s configuration.


Marco Bruni