Questions about PHP SAFE MODE restriction in effect

Source: Internet
Author: User
PHP SAFE MODE restriction in effect problem

When Safe_mode is set to on,php, the owner of the current script is checked by the file function or its directory to match the owner of the file that will be manipulated. Example:-rw-rw-r--1 Rasmus Rasmus Jul 1 19:20 script.php
-rw-r--r--1 root root 1116 May 18:01/etc/passwd
Run script.php readfile ('/etc/passwd ');
?>
If Safe mode is activated, the following error will be caused: Warning:safe mode restriction in effect. The script whose UID is
Allowed to access/etc/passwd owned by UID 0 in/docroot/script.php on line 2

Haohappy's argument:
The reason is that you use Safe mode, and the user uid of the file you upload and the UID of the owner are different, resulting in no access rights. For example, in Safe mode, your FTP upload user uid is 123, and after uploading the owner's UID is 456, this error will occur.

There are two ways to resolve this:
1. Turn off Safe mode;
2. Chown Change File/directory owner under command line
Of course both of these methods require you to have the server permissions.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.