Is it possible to restart the pc using php?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is true that you can use
exec()orsystem()but the permission will be the problem as PHP is run on the user that runapache.As a quick workaround, the user apache may be given permission to restart. Depending on your system, setting this can be quite hard.
Another way you can do is to have a Cron task (that belong to root) checking some file every minutes (or seconds) and have that file edited by your PHP program. The file is set to be editable by only Apache. This is much easier to do.
Hope this helps.