Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9018489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:32:24+00:00 2026-06-16T04:32:24+00:00

I have a previously working PHP script that is able to create a directory

  • 0

I have a previously working PHP script that is able to create a directory with mkdir:

$webfolder = "/var/www/html/images/user";
mkdir($webfolder, 0770);

I made some changes to the permission setting of the folder /var/www/html/images which is now:

drwxrwx---. myself apache system_u:object_r:httpd_sys_content_t:s0 images

I think previously this folder was owned by apache. But since apache has the full privileges of read, write and execute as a user group, I wonder why it can’t create a folder within. Using the mkdir produces a false boolean value.

Is the problem due to directory ownership or is there some other reasons? Note that I am using PHP version 5.4.

Error Log added:

[Mon Dec 17 11:12:34 2012] [error] [client 127.0.0.1] PHP Warning:
mkdir(): Permission denied in /var/www/html/upload on line 33,
referer: https://mywebsite.com/referer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:32:25+00:00Added an answer on June 16, 2026 at 4:32 am

    The answer is staring right in front of me, but I miss it due to my unfamiliarity with SELinux.

    The SELinux context type should be set as httpd_sys_content_rw_t instead of httpd_sys_content_t so that the folder is both readable and writable for apache. Changing the context recursively is done with the following command:

    # chcon -R -t httpd_sys_content_rw_t /var/www/html/images
    

    Good grief. Hope it helps others who come across this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to have a PHP script send an email that contains two images that
I have an image upload script that allows simple PHP upload of profile pictures.
I have previously been told that I should always use Randomize() before I use
Suppose that we have previously instantiated three objects A, B, C from class D
I'm looking to implement a REST client in PHP, and have previously been using
I'm trying to use PHP to create a file, but it isn't working. I
With the help from two previous questions, I now have a working HTML scraper
I have a PHP built calendar that displays dates for each month. Now what
I have a C# application that communicates with a PHP-based SOAP web service for
I am working on a emailer system that I have to plug in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.