File_exists and Realpath return false, but the file exists and permissions are correct

Source: Internet
Author: User
The questions below, which occur in PHP 5.5.14,
After testing, there is no problem after 5.4.30 ...
Do not know is 5.5.14 Bug or god horse's ...
Is there a way to solve the problem in 5.5.14?

(Note: The folder name has been coded in the text)
The actual code in PHP is as follows:


  
   

得到了结果如下:

string(28) "/home/wwwroot/m*****/u******" bool(false) bool(false) 

在网上找了好久,起初认为是文件夹权限,
所以我将 /home/wwwroot/ 下归递改为 755 (chmod -Rf 755 /home/wwwroot),
但是结果还是一样。

Reply content:

The questions below, which occur in PHP 5.5.14,
After testing, there is no problem after 5.4.30 ...
Do not know is 5.5.14 Bug or god horse's ...
Is there a way to solve the problem in 5.5.14?

(Note: The folder name has been coded in the text)
The actual code in PHP is as follows:


  
    

得到了结果如下:

string(28) "/home/wwwroot/m*****/u******" bool(false) bool(false) 

在网上找了好久,起初认为是文件夹权限,
所以我将 /home/wwwroot/ 下归递改为 755 (chmod -Rf 755 /home/wwwroot),
但是结果还是一样。

If it is a system of Redhat systems, Also check that SELinux permissions are correct

php file is not UTF8 encoded, the file name to be detected is not Chinese? If so, you need to transcode to gb2312,
Example:

file_exists (Iconv (' Utf-8 ', ' gbk ', ' d:/test/Chinese ah. txt ');  
  • 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.