使用PHP代码在Linux服务器上创建目录时出错

I have a group on linux named mygroup. and have a user named apache. apache is the member of mygroup.

i created a sample php file and uploaded on sever

    <?php

$structure = '/my_repo/hello';


if (!mkdir($structure, 0, true)) {
    die('Failed to create folders...');
}

?>

myrepo dir is at root level and is group is mygroup and owner is root. permissions are 764.

when i accessed my file on http://mydomain.com/sample.php

it gives me the following error

[warn] mod_fcgid: stderr: PHP Warning:  dir(/my_repo/hello) 
[<a href='function.dir'>function.dir</a>]: failed to open dir: 
Permission denied in /var/www/clients/client1/web2/web/sample.php 

problem resolved. there was permission issue on server. the code was uploaded through a different user, that was not having permission to myrepo directory.