I have an idea, and i have a single php local web page running on localhost
and i want to use GUI for 3 buttons : shut down , sleep and restart
Is PHP allows to me for these operations? Are there ready to write classes, methods in PHP?
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.
If your Apache/PHP configuration is setup to allow the use of
system, then you can use that.For *nix systems:
For Windows:
More info here.
As far as sleep/standby on *nix is concerned, it varies a lot.
Note: You can also use
shell_exec()orexec().EDIT:
Per user1597430’s comment, in *nix systems you can pass the
-h(halt) option which will essentially shut down and halt the CPUs but not disconnect the main power.Server fault has some great answers here about this.