cancel
Showing results for 
Search instead for 
Did you mean: 

PHP in safemode? Attributes of created folders?

N/A

PHP in safemode? Attributes of created folders?

The folders created with php have attributes as:
drwxr-xr-x 2 nobody nobody 4096 Sep 16 12:53 All Users
How can I change this to 777?
From telnet chmod does not work on these directories.

Could it be the problem is php running in "safe mode"?

Thanks very much.

Eli
8 REPLIES
N/A

PHP safemode

Is the following in the php.ini configuration responsible for these problems:
safe_mode_exec_dir 1

If yes, can this be changed?

Thanks,
Eli
N/A

PHP in safemode? Attributes of created folders?

Eli

Which directory path on the cgi server are you using? The cgi-bin directory (and I believe all of it's subdirectories) is special, in that chmod won't work on it. You can create a directory at the same level as the cgi-bin directory for your application and then use chmod as necessary. See other threads in this forum and on the PlusNet forums for more info.

Neil
N/A

PHP in safemode? Attributes of created folders?

Neil,

The directory I am using is parallel to the cgi-bin directory.
drwxr-xr-x 7 napchan shellcgi 4096 Sep 18 15:58 cgi-bin
drwxr-xr-x 14 napchan shellcgi 4096 Sep 14 16:55 intranet

The files concerned are in sub-dirs of intranet, which is parallel to the cgi-bin.

Eli
N/A

PHP in safemode? Attributes of created folders?

Eli

You should be able to chmod your intranet directory.

Can you capture the output from the following?:

ls -l

chmod 777 intranet
ls -l


This will change permissions on just the intranet directory itself, not the files and directories within it.

See this thread Very weak security for moe chmod info.

Neil

PS. You can search the forums for chmod!!
N/A

PHP in safemode? Attributes of created folders?

My intranet directory (as described above) is easily changed with chmod.
What I can not do is change anything that has user nobody attached to it: directories or files.

drwxr-xr-x 2 nobody nobody 4096 Sep 16 15:48 All Users_old
-rw-r--r-- 1 nobody nobody 41984 Sep 18 09:49 BRIDGE.xls
drwxr-xr-x 2 nobody nobody 4096 Sep 16 10:23 JohnWatton
drwxr-xr-x 2 nobody nobody 4096 Sep 16 10:25 JonStokes
-rw-r--r-- 1 nobody nobody 24576 Sep 18 09:43 Multi.doc
drwxr-xr-x 2 nobody nobody 4096 Sep 18 13:37 Nova
drwxr-xr-x 2 nobody nobody 4096 Sep 16 10:25 RJ

If I create something from a shell, I get:
-rw-r--r-- 1 napchan shellcgi 26910 Sep 18 14:54 phpi.htm
drwxrwxrwx 2 napchan shellcgi 4096 Sep 18 09:43 temp

which there is no problem changing, deleting, moving.

Thanks,
Eli

Eli
N/A

PHP in safemode? Attributes of created folders?

i dont know php but the files are being created by the web server which runs as user 'nobody' so within your php script you need to create the files with permissions 777. This can be done with Perl but I dont know if it can be done with php.

Don't know if its much help but its worth looking into.

Spid
N/A

PHP in safemode? Attributes of created folders?

I had the same thing happen to me yesterday, with files and directories in my CGI space being owned by "nobody" which means I cannot then change permissions or ownership. I've had to raise a Contact us request, asking support to issue a chown -R task * command in the /home/task directory.

Can anyone think of a cunning way to get the web server (user nobody) or possibly some other service running either as root or as nobody to issue a chown? If I set up cron to issue the command, say, once a day I assume it will run with my UID and therefore be useless?
N/A

PHP in safemode? Attributes of created folders?

have a look here http://www.php.net/manual/en/function.chmod.php

As far as I can see you can't chown without root priveleges so would have to chmod at file creation.

Spid