0
someone knows if there is a command in php or script that stops a service in the operating system ?
0
someone knows if there is a command in php or script that stops a service in the operating system ?
1
You can use the command exec
, and execute a killall -9 [nome_do_processo]
<?php
exec("killall -9 mysql"); // mysql, por exemplo
<?
Browser other questions tagged php operating-system centos
You are not signed in. Login or sign up in order to post.
Hmm cool I’ll try here Thanks !
– Lourençon O.
Rafael, I can for example in place of killall -9 put other commands, such as stopping apache by Centos, exec("sudo service httpd stop"); ??
– Lourençon O.
exec serves exactly for you to execute commands as if you were in a terminal. So, feel free. Thinking now, I just don’t know how the script will handle permission, unless you run PHP script with sudo.
– rafaels88
Cool Rafael, I’ll take a look here, anyway thanks guy ..
– Lourençon O.
=) good luck! You’re welcome!
– rafaels88