Home > php教程 > php手册 > body text

php控制linux服务器常用功能 关机 重启 开新站点等

WBOY
Release: 2016-06-13 11:58:41
Original
802 people have browsed it

php 里面有个 system 方法, 可以调用系统命令。
先建立一个脚本(比喻 /root/reboot_server.sh ),重启用的。

复制代码 代码如下:


#!/bin/bash
reboot


再给他赋予权限 4755
chown root:root /root/reboot_server.sh
chmod 4755 /root/reboot_server.sh
chmod 4777 /sbin/reboot

再在 php 里, 想办法做如下调用

复制代码 代码如下:


system("/root/reboot_server.sh");
?>


其它的功能 就是类似啦! 自己装个虚拟机玩吧!别真在服务器上玩挂了
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template