Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

php

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

        }else{
                echo "The dir is there";
        }

}

createdir("/music/pl/07012013/");
createdir("/music/albums/06012013333333331111/");

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.