safe mode/mkdir problem - HELP!
| From: | Roberto P.Martins Jr | Date: | Tue, 05 Feb 2002 23:39:48 +0000 |
| Subject: | safe mode/mkdir problem - HELP! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83657@lists.php.net to get a copy of this message | ||
Hello!
I'm trying to create a directory, let's say: /some/dir. My script
(create_dir.cgi) is located at the cgi-bin directory and begins with
#!/usr/bin/php. So it's like any other script, isn't it?
The problem is: running php in safe mode with the script permissions:
rwxr-xr-x 8 root root 1234 Nov 14 12:28 create_dir.cgi
I got:
Warning: MkDir failed (Permission denied) in
/var/www/cgi-bin/create_dir.cgi on line xxx
When executing the instruction: mkdir('/some/dir', 0755);
But /some permissions are:
drwxr-xr-x 8 root root 4096 Nov 14 12:28 /some
Running in safe mode, I thought that I could use mkdir() to create it,
because the ownerships are the same! Am I wrong? Safe mode only give
access when the ownerships are the same.
When I change the ownership to /some
to the uid/gid apache is running (apache(48)/apache(48)), I get:
Warning: SAFE MODE Restriction in effect. The script whose uid is 0 is
not allowed to access /some/dir owned by uid 48 in
/var/www/cgi-bin/create_dir.cgi on line xxx
And another doubt is: running my script as a cgi, with the php binary
outside the webserver tree, it runs like any other script (as written in
the manual). I should be able to run it is setuid flags and get complete
access, but even in this case the uid/gid that my script runs is always
the webserver process uid/gid (apache/apache)
I'm running RedHat Linux 7.2 with apache 1.3.22 and php 4.0.6. The php
package includes the php apache module and the php binary.
Thanks in advance,
Roberto