473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mkdir problems

5 New Member
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 1695
pbmods
5,821 Recognized Expert Expert
Heya, Fouad.

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

thanks
Jul 28 '08 #3
pbmods
5,821 Recognized Expert Expert
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

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

Similar topics

2
1756
by: Shaun | last post by:
Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir("/test/"a) the last line does not seem to work. os.mkdir(a) makes the directory
8
6061
by: Sue | last post by:
AccessXP in Access2000 Mode: In my code I use the MkDir method to create a folder and then I want to use the transfertext method to create a delimited text file in that folder. MkDir runs and then when transfertext runs I get a message that a file can not be created in the folder because the folder is Read Only. When I check the folder's attributes with Windows Explorer, sure enough the folder is Read Only. How can I use the MkDir...
2
2585
by: Juby | last post by:
I'm creating a script for our website which will function as something of a docment manager. The backend features an option to create a new directory in the uploads subdirectory. The problem is, once I've used mkdir() to create this file, when I later run is_dir() on the filename, I get 'false'. Even worse, if I run is_file() on the new directories, I get false as well. The same thing seems to be happening to files I submit via the...
1
1690
by: joelbyrd | last post by:
I'm trying to do a mkdir(), but I'm getting permission denied error, even though I've set the mode to 0777: mkdir($full_path, 0777). I also couldn't do a chmod successfully. The code is something like: mkdir("/home/httpd/vhosts/website.com/httpdocs/dev1/test_folder1", 0777); What's the problem?
5
9276
by: eoindeb | last post by:
I am trying to create a directory on Solaris using the mkdir() function. This works fine when I pass a string literal ("/etc/hosts") to mkdir, but if I try passing a directory pointer to mkdir, it returns a -1 error. The directory error works fine with fopen - does anyone know what I am doing wrong?? Here's a snippet of the code: int Check_Directory() //check for existence of directory - if not there, create the file { int status, ret...
30
7713
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the target directory (where the backup copies will be kept, on another drive). I can successfully test whether the target directory exists or not using findfirst(), but if it doesn't, I wanted to create it using mkdir(), but it doesn't like the path...
8
24535
by: vj | last post by:
How do I do the following unix command: mkdir -m770 test with the os.mkdir command. Using os.mkdir(mode=0770) ends with the incorrect permissions. Thanks, VJ
1
1898
by: B | last post by:
Hi, I am using mkdir to create a directory and upload files to it. Unfortunately the folder is accessible via the url to any user, which is creating problems. How can I manage permissions with mkdir so the folder is not availabe via the url path thanks :)
2
1994
by: _q_u_a_m_i_s's | last post by:
Hy, i encountered a weird problem on a server running php5, and apache. Seems like i cannot create folders that end with "/". for example: mkdir("test/") will fail mkdir("test") will work Is there any issue with mkdir that i don`t know about? or safe_mode affects this in any way? The problem is that mkdir is called in lots of different places in the
0
10491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10268
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10247
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.