What should I do if php cannot call linux commands?

藏色散人
Release: 2023-03-09 18:12:02
Original
1746 people have browsed it

How to solve the problem that php cannot call linux commands: 1. Turn off selinux; 2. Add the apache user in the httpd.conf configuration file to use all commands; 3. Modify the default permissions for starting apache.

What should I do if php cannot call linux commands?

The operating environment of this article: linux5.9.8 system, PHP7.1 version, DELL G3 computer

php cannot call the linux command: authorization denied or The audit interface cannot be opened

1. Close selinux

Method

a. Quickly close SElinux. Use the following command:

  /usr/sbin/setenforce 0 立刻关闭 SELINUX
  /usr/sbin/setenforce 1 立刻启用 SELINUX
Copy after login

b. Add to The system starts by default

  echo "/usr/sbin/setenforce 0" >> /etc/rc.local
Copy after login

c. You can edit the configuration file to achieve the same purpose

     vi /etc/selinux/conf
     set SELINUX=disabled
Copy after login

2. Add the apache user to the httpd.conf configuration file to use all commands without a password

disable_functions= in the php.ini file cancels restrictions on related functions

3. Modify the default permissions for starting apache

Method

a, Modification

        vi /etc/passwd
  vi /etc/group
        vi/etc/sudoers
Copy after login

b. Add the apache user to the corresponding file/folder owner chown user.group FoldersName

Modify permissions chmod 775 Foldersname

Recommended learning: "PHP video tutorial

The above is the detailed content of What should I do if php cannot call linux commands?. 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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template