ID: 40537
User updated by: stloukal at programator dot cz
Reported By: stloukal at programator dot cz
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: FC4, 2.6.17
PHP Version: 5.2.1
New Comment:
OK, sorry for inconvenience. I created in my DocumentRoot
(/var/www/web/) directories "bug_test" and "tmp" (both 0777
permissions). No symlinks are used! Then I placed script
gallery_test.php (see my post from [19 Feb 12:26pm UTC]) into the
bug_test directory. That's all. Script behaviour matches the described
bug.
Previous Comments:
------------------------------------------------------------------------
[2007-02-26 12:53:11] [EMAIL PROTECTED]
I'm totally lost in your paths,
"/home/chroot/home/krtek/web/tuzemsko/tmp/", which is actually
"/var/www/web/tuzemsko/krtek/web/tuzemsko/tmp" is a bit hard to read
and recreate.
Please provide simple and clear directory structure I need to create in
order to reproduce it.
For example:
/www/tmp - upload dir
/www - scripts dir
etc. etc.
------------------------------------------------------------------------
[2007-02-26 12:42:27] stloukal at programator dot cz
Hello,
I don't know, what to fix. I can use the same configuration, the same
symlinks, the same script and when I change the name of the target
directory (e.g. ../../tmp/test/ or ../../temp/) everything works fine
without problems. I don't think the problem is in the symlinks. Even if
I create symlink for "tmp" named "temp" and I use "../../temp" path
instead "../../tmp" path, it works fine.
------------------------------------------------------------------------
[2007-02-26 09:53:58] [EMAIL PROTECTED]
Cannot reproduce.
Fix your symlinks pointing to and out chroots.
------------------------------------------------------------------------
[2007-02-19 12:26:22] stloukal at programator dot cz
Hello,
here is working code that demonstrates described bug. I append some
configuration that may be interesting for you.
Configuration:
Safe mode: off
$_SERVER[SCRIPT_FILENAME]:
/var/www/web/tuzemsko/krtek/admin/gallery_test.php
real path of the script:
/home/chroot/home/krtek/web/tuzemsko/www/admin/gallery_test.php
/var/www/web/tuzemsko/krtek is a symbolic link to
/home/chroot/home/krtek/web/tuzemsko/www/.
httpd.conf:
<Directory "/var/www/web/tuzemsko/krtek">
php_admin_value upload_tmp_dir /home/chroot/tmp/
php_admin_value open_basedir
/var/www/web/tuzemsko/krtek/:/home/chroot/tmp/:/home/chroot/home/krtek/web/
</Directory>
Directory /home/chroot/home/krtek/web/tuzemsko/tmp/ has 0777
permissions.
-------------------------------------------------------
Script:
<?php
// *************** UPLOAD FOTKY ***************
if ($_REQUEST['load_pic']) {
$name = 'galerie_'.$_FILES['soubor']['name'];
$path = '../../tmp/'.$name;
echo 'uploaded: '.$_FILES['soubor']['tmp_name'].' =
'.(int)file_exists($_FILES['soubor']['tmp_name']);
$res = move_uploaded_file($_FILES['soubor']['tmp_name'],
$path);
echo ' moved: '.$path.' = '.(int)file_exists($path);
}
// *************** UPLOAD FOTKY KONEC ***************
echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
<input type="file" name="soubor" />
<input type="submit" value="Save" />
<input type="hidden" name="load_pic" value="true" />
</form>
';
?>
Everything worked fine with 5.1.2 version.
------------------------------------------------------------------------
[2007-02-19 10:01:27] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40537
--
Edit this bug report at http://bugs.php.net/?id=40537&edit=1