On the server my php site is hosted SAFE MODE is on.
I can't use functions like mkdir() or chmod() because UID of script is said to be 1161 instead of 1000 as posix functions state if i interrogate them.
1) Why is UID 1161 and not 1000?
2) Where 1161 UID is coming from?
3) How can i check that UID is 1161?
4) HOW CAN I USE FUNCTIONS LIKE mkdir() OR chmod() AGAIN?
I can't disable SAFE MODE and I can't use a relaxed GID compare istead of UID compare because my host server does not allow me.
here are some cut and paste from my test script output:
posix_getuid() : 1000
posix_geteuid(): 1000
posix_getegid(): 1000
posix_getgid(): 1000
posix_getgrgid:
Array ( [name] => web [passwd] => x [members] => Array ( ) [gid] => 1000 )
posix_getpwuid :
Array ( [name] => web [passwd] => x [uid] => 1000 [gid] => 1000 [gecos] => Web,,, [dir] => /home/web [shell] => /bin/false )
posix_getgroups():
Array ( [0] => 1000 )
posix_getpgrp:14225
posix_getpid:21851
posix_setgid(1161) failed.
posix_setuid(1161) failed.
posix_setegid(1161) failed.
posix_seteuid(1161) failed.
Warning: chmod(): SAFE MODE Restriction in effect. The script whose uid is 1161 is not allowed to access Cache_copy_02_06_2004/HomePage/ owned by uid 1000 in /workdisk/home/web/www.xxxxxx.xx/htdocs/temp_chmod.php on line 50
chmod failed.
Hope someone can help.
tnx
P.S.: I found this comment on php.net php on.line manual relating to safe mode:
"Beware that when in safe mode, mkdir creates folders with apache's UID, though the files you create in them are of your script's UID (usually the same as your FTP uid).
What this means is that if you create a folder, you won't be able to remove it, nor to remove any of the files you've created in it (because those operations require the UID to be the same).
Ideally mkdir should create the folder with the script's UID, but this has already been discussed and will not be fixed in the near future.
In the meantime, I would advice NOT to user mkdir in safe mode, as you may end up with folders you can't remove/use."
:eek:
Wow that's bad news! :queasy:
P.P.S: I found that getmyuid() functions actually gives 1161 as UID. So that answer my question n.2 e n.3.
Reading on php.net i found this is a bug of php that wont be fixed. :bemused:
Still if somebody has a solution it would be appreciated.
bye