|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-09 10:21 UTC] xdl at mail dot ru
<?
function s($c) {
echo "\$ $c\n";
system($c);
echo "\n";
}
function wr($f) {
if(is_writable($f)) {
echo "<b>$f</b> is writable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font> writable.\n";
}
if(is_readable($f)) {
echo "<b>$f</b> is readable.\n";
} else {
echo "<b>$f</b> is <font color='red'>NOT</font> readable.\n";
}
}
$dir = "attachments";
s("whoami");
s("pwd");
s("ls -ld $dir");
wr($dir);
$dir2 = "$dir/test";
mkdir("$dir2");
wr($dir2);
//$dir3 = `pwd`;
$dir3 = $DOCUMENT_ROOT . "/phpbt/" . $dir;
wr($dir3);
?>
Output is:
------------------------------
$ whoami
nobody
$ pwd
/usr/local/httpd/web/phpbt
$ ls -ld attachments
drwxrwxrwx 4 nobody nogroup 4096 Jan 9 18:50 attachments
attachments is NOT writable.
attachments is NOT readable.
attachments/test is NOT writable.
attachments/test is NOT readable.
/usr/local/httpd/web/phpbt/attachments is writable.
/usr/local/httpd/web/phpbt/attachments is readable.
------------------------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 16:00:01 2025 UTC |
<? function s($c) { echo "\$ $c\n"; system($c); echo "\n"; } function wr($f) { if(is_writable($f)) { echo "<b>$f</b> is writable.\n"; } else { echo "<b>$f</b> is <font color='red'>NOT</font> writable.\n"; } if(is_readable($f)) { echo "<b>$f</b> is readable.\n"; } else { echo "<b>$f</b> is <font color='red'>NOT</font> readable.\n"; } } $dir = "attachments"; s("whoami"); s("pwd"); s("ls -ld $dir"); wr($dir); $dir2 = "$dir/test"; mkdir("$dir2"); wr($dir2); //$dir3 = `pwd`; $dir3 = $DOCUMENT_ROOT . "/phpbt/" . $dir; wr($dir3); ?> Output is: ------------------------------ $ whoami nobody $ pwd /usr/local/httpd/web/phpbt $ ls -ld attachments drwxrwxrwx 4 nobody nogroup 4096 Jan 9 18:50 attachments attachments is NOT writable. attachments is NOT readable. attachments/test is NOT writable. attachments/test is NOT readable. /usr/local/httpd/web/phpbt/attachments is writable. /usr/local/httpd/web/phpbt/attachments is readable. ------------------------------Yes, in PHP 4.3.0 the bug is fixed. Thank you! --------------------------------------------- <? header("Content-type: text/plain"); function s($c) { echo "\$ $c\n"; system($c); echo "\n"; } function wr($f) { if(is_writable($f)) { echo "$f is writable.\n"; } else { echo "$f is NOT writable.\n"; } if(is_readable($f)) { echo "$f is readable.\n"; } else { echo "$f is NOT readable.\n"; } } $dir = "attachments"; s("whoami"); s("pwd"); s("ls -ld $dir"); echo "PHP version = ".phpversion()."\n"; echo "getcwd() = ".getcwd()."\n"; wr($dir); $dir2 = "$dir/test"; mkdir("$dir2"); wr($dir2); $dir3 = $DOCUMENT_ROOT . "/phpbt/" . $dir; wr($dir3); ?> --------------------------------------------- $ whoami nobody $ pwd /usr/local/httpd/web/phpbt $ ls -ld attachments drwxrwxrwx 4 nobody nogroup 4096 Feb 8 03:43 attachments PHP version = 4.3.0 getcwd() = /usr/local/httpd/web/phpbt attachments is writable. attachments is readable. attachments/test is writable. attachments/test is readable. /usr/local/httpd/web/phpbt/attachments is writable. /usr/local/httpd/web/phpbt/attachments is readable. ---------------------------------------------