步骤如下:
vi /etc/sudoers
加上一句 apache ALL=(ALL) NOPASSWD: ALL
然后在php中加上sudo就可以执行任何命令了
exec("sudo reboot");
?>
如果系统运行sudo 反应速度非常慢
可以进行如下操作进行提升速度
用"hostname "命令查看当前主机的主机名称。例如,该命令返回"www.siteyun.com ".
再用vi打开"/etc/hosts"文件,并将"ddx.net"加入到 "127.0.0.1"这行中。
例如:
127.0.0.1 www.siteyun.com localhost.localdomain localhost
保存搞定。
本人用PHP来控制一些服务器重启,及些服务的重启等操作

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
