471,107 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,107 software developers and data experts.

mkdir problems

5
hi everyone....

i am trying to create a folder in my home directory but that ain't working due to permission restriction

my code looks like the following:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $path = "/home/fouad/testing";
  3. if(mkdir($path,700,TRUE)) {print "success."; }else {print "failure.";}
  4. ?>
  5.  
and my output is the following:
Expand|Select|Wrap|Line Numbers
  1.  Warning: mkdir() [function.mkdir]: Permission denied in /var/www/test2.php on line 3 
  2. failure.
  3.  
i know it is related to permissions but i dunno how to fix that....

please help

thanks in advance
Jul 27 '08 #1
3 1488
pbmods
5,821 Expert 4TB
Heya, Fouad.

Make sure you have write permissions in /home/fouad.
Jul 27 '08 #2
fouadk
5
write permissions to which users??? user of php ??? user of apache ????
which user???

thanks
Jul 28 '08 #3
pbmods
5,821 Expert 4TB
PHP runs as whatever User/group that Apache does, so as long as the directory is writable to Apache, it will be writable to PHP.

If Apache can read from the directory, you simply need to add write permissions.

Try each the following commands in this order until you get it working:
Expand|Select|Wrap|Line Numbers
  1. chmod 755 /home/fouad
  2. chmod 775 /home/fouad
  3. chmod 777 /home/fouad
  4.  
The last one is the least secure, but is guaranteed to work.
Jul 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Sue | last post: by
2 posts views Thread by Juby | last post: by
1 post views Thread by joelbyrd | last post: by
5 posts views Thread by eoindeb | last post: by
30 posts views Thread by MikeC | last post: by
8 posts views Thread by vj | last post: by
1 post views Thread by B | last post: by
2 posts views Thread by _q_u_a_m_i_s's | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.