Is_writable returns false

Source: Internet
Author: User
Is_writable returns false. I have a test. php file with the following content:
If (is_writable ("/home/www/testapp/image/cache "))
{
Echo ("can write! ");
}
Else
{
Echo ("can not write! ");
}
?>
Run the command line to return "can write !"
Php test. php
However, when you access the website, the returned result is can not write!
In addition, run the sudo-u apache php test. php command to return the can not write!

Run ps aux | grep apache to view the following user information:
Apache 17446 0.0 2.5 373988 49420? S Jan13 0: 06/usr/sbin/httpd
Apache 17447 0.0 2.5 373760 49084? S Jan13 0: 07/usr/sbin/httpd
Apache 17448 0.0 3.2 387204 62392? S Jan13 0: 05/usr/sbin/httpd
Apache 17449 0.0 2.0 360468 39820? S Jan13 0: 06/usr/sbin/httpd
Apache 17450 0.0 3.0 383112 58328? S Jan13 0: 06/usr/sbin/httpd
Apache 17451 0.0 3.0 382332 57808? S Jan13 0: 06/usr/sbin/httpd
Apache 17452 0.0 2.6 374792 50300? S Jan13 0: 05/usr/sbin/httpd
Apache 17453 0.0 2.5 372472 48364? S Jan13 0: 07/usr/sbin/httpd
Apache 17942 0.0 2.3 365588 45172? S Jan13 0: 05/usr/sbin/httpd
Apache 19042 0.0 3.0 384096 59060? S Jan14 0: 04/usr/sbin/httpd
Apache 19115 0.0 2.4 372488 47748? S Jan14 0: 02/usr/sbin/httpd

The cache permission is changed to apache.
Drw-rw-2 apache 4096 October 20 22:18 cache
Drwxrwxrwx 3 apache 4096 January 16 2015 catalog

My question is, why is my website or apache account always rejected and cannot be written? thank you very much for your help !!



Reply to discussion (solution)

Php test. php is acceptable. it should be root.
Sudo-u apache php test. php does not work

Indicates that the user of apache has no write permission.

Catalog: this is 777. do you have the permission to write it?

No is_writable

I found the reason. because the parent folder does not have the permission, even if the sub-folder has the permission, it will not work. but thank you very much ~

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.