Heim  >  Artikel  >  Backend-Entwicklung  >  php控制linux服务器常用功能 关机 重启 开新站点等_PHP教程

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

WBOY
WBOYOriginal
2016-07-21 15:16:54838Durchsuche

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");
?>

其它的功能 就是类似啦! 自己装个虚拟机玩吧!别真在服务器上玩挂了

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/325850.htmlTechArticlephp 里面有个 system 方法, 可以调用系统命令。 先建立一个脚本(比喻 /root/reboot_server.sh ),重启用的。 复制代码 代码如下: #!/bin/bash rebo...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn