473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

problem setting permisions


I'm not sure if this is a linux, apache or PHP problem but I'm using PHP
to do it so I'll start here:

if I do
$myDir = '/temp/';

mkdir($myDir,0777);
chmod($myDir,0777);

I get a directory with 777 permissions. That seems fine.
(The chmod seems needed to undo a mask)
The directory is created with owner & user as Apache

However if I now do:
if (!mkdir($myDir . 'subDir/',0777)) {
echo('Creation error');
}
chmod($myDir . 'subDir/',0777);

I've tried removing the trailing slash to no effect.

PHP fails to create subDir/ at all AND doesn't flag up the error.
I expect I'm missing something fundamental but can't see what.

Can anyone help please?
May 23 '07 #1
4 1185
At Wed, 23 May 2007 17:22:28 +0000, harvey let his monkeys type:
>
I'm not sure if this is a linux, apache or PHP problem but I'm using PHP
to do it so I'll start here:

if I do
$myDir = '/temp/';

mkdir($myDir,0777);
chmod($myDir,0777);

I get a directory with 777 permissions. That seems fine.
(The chmod seems needed to undo a mask)
The directory is created with owner & user as Apache

However if I now do:
if (!mkdir($myDir . 'subDir/',0777)) {
echo('Creation error');
}
chmod($myDir . 'subDir/',0777);

I've tried removing the trailing slash to no effect.

PHP fails to create subDir/ at all AND doesn't flag up the error.
I expect I'm missing something fundamental but can't see what.

Can anyone help please?
Maybe to do with the trailing '/'
Have a look at the user comments at:
http://www.php.net/manual/en/function.mkdir.php

HTH
Sh

May 23 '07 #2
In article <pa****************************@invalid.spam>,
in*****@invalid.spam says...
http://www.php.net/manual/en/function.mkdir.php
Thanks for that heads up -
Surely someone has a simple solution for this that will work anywhere?
Using FTP (as suggested) just seems absurd to me.

After reading the above link I think I can sumarise with:
-----------------[ CUT ]------------
If you're on a shared *nix server, a directory created through mkdir()
will not be assigned to you, but to the user that your host's server or
php process is running under, usually 'nobody', 'apache' or 'httpd'.

In practice, this means that you can create directories, even add files
to them, but you can't delete the directory or its contents nor change
permissions.

-----------------[ END CUT ]------------

It is also incomplete - it appears you cannot create sub-dirs in them
without taking extra steps ... using umask() and sticky bits depending
on configuration. And even then it doesn't always work nor report
the failure.

All this can't be right can it?

May 24 '07 #3
At Thu, 24 May 2007 10:55:45 +0000, harvey let his monkeys type:
In article <pa****************************@invalid.spam>,
in*****@invalid.spam says...
>http://www.php.net/manual/en/function.mkdir.php

Thanks for that heads up -
Surely someone has a simple solution for this that will work anywhere?
Using FTP (as suggested) just seems absurd to me.

After reading the above link I think I can sumarise with:
-----------------[ CUT ]------------
If you're on a shared *nix server, a directory created through mkdir()
will not be assigned to you, but to the user that your host's server or
php process is running under, usually 'nobody', 'apache' or 'httpd'.

In practice, this means that you can create directories, even add files
to them, but you can't delete the directory or its contents nor change
permissions.

-----------------[ END CUT ]------------

It is also incomplete - it appears you cannot create sub-dirs in them
without taking extra steps ... using umask() and sticky bits depending
on configuration. And even then it doesn't always work nor report
the failure.

All this can't be right can it?
If I am not overlooking something obvious, if apache:apache is the dir
owner, your script should be able to make a subdir in it, since the script
operates as apache:apache.

However it may be a problem accessing these dirs via FTP (other user:group)

SH

May 24 '07 #4
In article <pa****************************@invalid.spam>,
in*****@invalid.spam says...
>
If I am not overlooking something obvious, if apache:apache is the dir
owner, your script should be able to make a subdir in it, since the script
operates as apache:apache.

However it may be a problem accessing these dirs via FTP (other user:group)

SH
I suspect we are both overlooking something - I'm having great trouble
making this work.
May 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave | last post by:
Hello All, I've created a problem by not reading instruction and now I don't know what to do :( I tried to install 9i on my redhat 9.0 box as myself without going thru the proper procedure of...
1
by: Tjerk Wolterink | last post by:
Hello i'm using php with xml. I've an rather big xsl file, that has the following code in it: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"...
2
by: Tjerk Wolterink | last post by:
Hello i've an xpath problem using sablatron in php. In xsl i have the following code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
6
by: harry | last post by:
Hi, I have a program that runs on multiple client pc's. Occasionally one or more of those pc's use VPN to connect to another corporate network. When using VPN they need to set proxy server in...
5
by: DanC | last post by:
I try to execute a program in ASP but i get an error. Even with script below i get 1 as result. What's wrong? Pse help, i'm new in ASP. greets DanC <%@ LANGUAGE="JSCript" %>
16
by: Marina | last post by:
Hi, I am trying to find the minimum security settings to allow a windows control embedded in IE have full trust. If I give the entire Intranet zone full trust, this works. However, this is...
5
by: snow | last post by:
Hi All, ToOADate can change a date value to a double value, but if I change the Regional and Lauguage setting in control panel, for example, change English(US) to English(Australia) , the same...
0
by: ngeluis | last post by:
I also use Thinstall on my .net application that is used on more then 1000 laptops using network and to be true... It rocks.. because no Framework 2.0 installation needed, i dont have to give...
4
by: phirestorm | last post by:
Hopefully someone can help me with an issue i am having. First off let me say that i have little to no experience with MS SQL or SQL in general. We have a Windows 2003 server running MSSQL (i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.