php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37672 Cannot start script from directory containing international characters.
Submitted: 2006-06-02 08:41 UTC Modified: 2016-08-08 09:47 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: php-bugs at shad dot pp dot ru Assigned: ab (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.14 OS: Windows Server 2003 SP2
Private report: No CVE-ID: None
 [2006-06-02 08:41 UTC] php-bugs at shad dot pp dot ru
Description:
------------
Scripts within directories containing international characters cannot be executed. I got these messages in error log:

[Fri Jun 02 12:25:49 2006] [error] [client 195.131.159.151] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0, referer: http://musicstation.spb.ru/files/
[Fri Jun 02 12:25:49 2006] [error] [client 195.131.159.151] PHP Warning:  Unknown: Failed opening 'D:/www/musicstation.spb.ru/files/\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xbe\xd0\xb5_\xd0\xb8\xd0\xbc\xd1\x8f/index.php' for inclusion (include_path='.;C:\\php5\\pear') in Unknown on line 0, referer: http://musicstation.spb.ru/files/

This is not a problem of apache, because I can access normal html documents and other files in such directories.

My configuration is:
Windows 2000 SP4 + hotfixes / Apache 2.0.48 / PHP 5.1.4 installed as Apache2 module / NTFS filesystem.


Patches

fix37672 (last revision 2013-08-21 04:31 UTC by ku at digitaldolphins dot jp)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-02 10:36 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2006-06-18 18:13 UTC] php-bugs at shad dot pp dot ru
I've asked in php-windows maillist and received no answer. If you know where's the problem, please, post it here. Or post a ling to FAQ where I can find a solution. But I beleive, if you read my report a bit more carefully, you will see it's a problem of PHP. Let me explain. I can access every directory or file regardless of what characters are used for it's name, I can access (download or view for example) every file within such directory. But I CAN'T run a PHP script from such directory. PHP treats 'current directory' wrong after which it tries to include something from wrongly detected directory name and fails. It's PHP problem. If you want, I can produce an example directory, from which you will be able to download text and binary files, but get a blank screen trying to access _working_ PHP script. I will put the same script in another directory and it will work from there, you will see that. I will produce you any logs you want.
 [2006-06-19 07:23 UTC] tony2001@php.net
We're working on Unicode support in PHP6. Feel free to help us testing/improving it.
Until then you have to live with what you have now.
 [2006-06-19 08:29 UTC] php-bugs at shad dot pp dot ru
You don't need unicode support to access directory with normal non-latin characters. Every other non-unicode program can access, correctly display name, rename or delete them using ANSI file api, which is used by PHP.
 [2006-06-19 09:28 UTC] tony2001@php.net
Every other PHP user (including me) is able to open file directory containing non-ASCII characters.
You didn't provide a piece of information (except for the error message) required to identify your problem.
Please provide at least something useful.
Until then -> bogus.
 [2006-06-19 10:50 UTC] php-bugs at shad dot pp dot ru
Ok, here is an example.

http://home.shad.pp.ru/test/

In this test directory you will find another directory containing cyrillic characters. Directory listing is provided via PHP script index.php, which is the same in both directories. If you try to access this cyrillic named directory, you will get blank screen. But you can access any file within this directory by direct links:

http://home.shad.pp.ru/test/%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D0%B0/text.txt
http://home.shad.pp.ru/test/%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D0%B0/test.rar

I also made simple script containing only one command:

<?php
  echo 'Hello world!';
?>

Put it in the same directory as test.php. You will also get blank screen, trying to access it by url:
http://home.shad.pp.ru/test/%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D0%B0/test.php
 [2007-01-07 18:55 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2007-01-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-09-08 14:10 UTC] php-bugs at shad dot pp dot ru
Still not fixed in PHP 5.2.14.
 [2010-09-08 14:22 UTC] php-bugs at shad dot pp dot ru
-Status: No Feedback +Status: Closed -Package: Unknown/Other Function +Package: Apache2 related -Operating System: Windows 2000 SP4 + hotfixes +Operating System: Windows Server 2003 SP2 -PHP Version: 5.1.4 +PHP Version: 5.2.14
 [2010-09-08 14:22 UTC] php-bugs at shad dot pp dot ru
Nothing changed since my first bug report. I updated details and reopened issue.

[Wed Sep 08 16:10:27 2010] [error] [client 193.105.104.4] PHP Fatal error:  Unknown: Failed opening required 'D:/www/default/test/\xd0\xba\xd0\xb8\xd1\x80\xd0\xb8\xd0\xbb\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb0/test.php' (include_path='.;C:\\php5\\pear') in Unknown on line 0

I believe, this is a problem with apache2 handler. Looks like it doesn't understand/decode the path that Apache is providing to it.
 [2010-09-08 14:23 UTC] php-bugs at shad dot pp dot ru
For some reason I cannot reopen this bug. I hope someone can do that.
 [2010-09-08 14:23 UTC] php-bugs at shad dot pp dot ru
-Status: Closed +Status: Assigned
 [2010-09-08 14:23 UTC] php-bugs at shad dot pp dot ru
Test
 [2010-09-09 06:33 UTC] aharvey@php.net
-Status: Assigned +Status: Re-Opened -Package: Apache2 related +Package: Scripting Engine problem
 [2013-08-21 02:25 UTC] ku at digitaldolphins dot jp
Hi.

I have same problem too!

It seems that php5apache2_2.dll assumes request_rec::filename as ANSI charset. 
However it will be UTF-8.

It'll need charset conversion: from UTF-8 to local ANSI codepage.

Check C:\php-sdk\php54dev\vc9\x86\php-5.4.18\sapi\apache2handler\sapi_apache2.c
---
static int php_handler(request_rec *r)
{
...
  zend_file_handle zfd;

  zfd.type = ZEND_HANDLE_FILENAME;
  zfd.filename = (char *) r->filename;
  zfd.free_filename = 0;
  zfd.opened_path = NULL;
...
---

What do you think about it?

Thanks.
 [2013-08-21 04:36 UTC] ku at digitaldolphins dot jp
I have posted my patch. It works fine for me!

Thanks
 [2016-08-08 09:47 UTC] ab@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: ab
 [2016-08-08 09:47 UTC] ab@php.net
Fixed in PHP 7.1. Please test it carefully and report issues in a new ticket.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC