centos7 - The file generated by executing the command in centos php cli mode has root user permissions, which will cause the web page to be unable to read this file.

WBOY
Release: 2023-03-03 11:04:01
Original
2579 people have browsed it

The file generated by executing the command in centos php cli mode has root user permissions, which will cause the web page to be unable to read the file. It will be saved later. Have any experts in the group encountered this problem? How to execute the command in php cli Permission issuescentos7 - The file generated by executing the command in centos php cli mode has root user permissions, which will cause the web page to be unable to read this file.

Reply content:

The file generated by executing the command in centos php cli mode has root user permissions, which will cause the web page to be unable to read the file. It will be saved later. Have any experts in the group encountered this problem? How to execute the command in php cli Permission issuescentos7 - The file generated by executing the command in centos php cli mode has root user permissions, which will cause the web page to be unable to read this file.

You should not use root to run a business script. You can choose to use the same user as nginx / php-fpm / apache httpd, or a user in the same user group to run the file

For some reasons (to be honest, I can’t find many reasons why root is required to run), you must use root. You can use sudo -u [user name]to temporarily switch users to run under root, or in the file After generation, use chown to modify the file ownership (chgrp, chmod, etc.)

Finally, if you run the program through crontab, you can also specify the user

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!