Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've php script that should create two new folders in "albums" and "pl". in "albums" apache can create a new folder but not in "pl", even though they have the same permissions. I can't understand what I'm doing wrong.

ls -Z /music
drwxrwxrwx. apache root system_u:object_r:unlabeled_t:s0 albums
drwxrwxrwx. apache root system_u:object_r:unlabeled_t:s0 pl


function createdir($dir) {
        if (!is_dir($dir)) {
                if (is_dir($dir)) {
                        echo "PASS<br />";
                        echo "FAILED<br />";

                echo "The dir is there";



su apache

su - apache -s /bin/bash
-bash-4.1$ mkdir /music/pl/06012013
mkdir: cannot create directory `/music/pl/06012013': Permission denied
share|improve this question
what's in your script? how do you mkdir? – CSᵠ Jan 5 '13 at 23:31
how about trying to run as apache and try to make a directory (via commandline). 'su apache' That way you can get better error response and diagnose the permissions issue you may have. – u8sand Jan 5 '13 at 23:43

Check out php's mkdir.

You'll need to set recursive to true, so try something like mkdir($dir,0700,true)

share|improve this answer
didn't work ... – teslasimus Jan 6 '13 at 11:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .