Php control linux server common functions shutdown restart start new site, etc.
Source: Internet
Author: User
The server host is CentOS. every time you restart or shut down the server, you have to connect to the server through the client. could you please use the PHP page to shut down the system or restart the server? there is a system method in php, you can call system commands.
Create a script (like/root/reboot_server.sh) and restart it.
Copy codeThe code is as follows:
#! /Bin/bash
Reboot
Grant him another permission of 4755
Chown root: root/reboot_server.sh
Chmod 4755/root/reboot_server.sh
Chmod 4777/sbin/reboot
In php, try to call the following method:
Copy codeThe code is as follows:
System ("/root/reboot_server.sh ");
?>
Other functions are similar! Install a virtual machine on your own! Stop playing on the server.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.