About common functions of php controlling linux server

不言
Release: 2023-04-01 10:20:02
Original
1734 people have browsed it

This article mainly introduces the common functions of controlling the Linux server with PHP. It has a certain reference value. Now I share it with you. Friends in need can refer to it.

The server host is CentOS. Every time Restarting and shutting down have to be connected through the client. I would like to ask if the shutdown and restart operations of the system can be realized through the PHP page

There is a system method in php, which can call system commands.
First create a script (eg /root/reboot_server.sh) for restarting.

#!/bin/bash 
reboot
Copy after login

Give him permissions 4755
chown root:root /root/reboot_server.sh
chmod 4755 /root/reboot_server.sh
chmod 4777 /sbin/reboot

In php, find a way to make the following call

Copy after login

Other functions are similar! Install a virtual machine yourself and play! Don’t really hang up on the server

The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to solve the problem of PHP scheduled sending service

The above is the detailed content of About common functions of php controlling linux server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!