Edit report at http://bugs.php.net/bug.php?id=50203&edit=1
ID: 50203
Comment by: tsanchev at gmail dot com
Reported by: vadim at sukhomlinov dot ru
Summary: Apache +mod_php can't load script with non-ASCII
name
Status: Open
Type: Bug
Package: Apache2 related
Operating System: win32 only - Windows XP SP3
PHP Version: 5.3.0
Block user comment: N
Private report: N
New Comment:
Directory listing from pache:
Index of /cosmetic-academy
Parent Directory
assets/
pl0_p0_ÐозмеÑик Ðкадеми_html.php
ддадада д аÑд аÑдdasdasd aдаÑÑÑÑ.txt
when try to execute the sctript in the directory i get this error:
Warning: Unknown: failed to open stream: No such file or directory in
Unknown on
line 0
Fatal error: Unknown: Failed opening required 'D:/web/www/cosmetic-
academy/pl0_p0_ÐозмеÑик Ðкадеми_html.php'
(include_path='.;C:\php5\pear') in
Unknown on line 0
if the name contain only ascii chars it works perfectly
Previous Comments:
------------------------------------------------------------------------
[2009-11-17 10:30:38] vadim at sukhomlinov dot ru
Description:
------------
When I use Apache 2.2.14 + PHP 5.3 standalone and request such script
directly by name it doesn't start (at least with mod_php), but in log
files I see something like:
[error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening
required
'E:/www/test2/\xd0\x9d\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8.php'
(include_path='.;C:\\php5\\pear') in Unknown on line 0, referer:
http://test2.ru/
I discovered this is because PHP doesn't translate UTF-8 filename passed
from Apache to coding (Unicode-16?) used by Windows, and thus can't open
it. It works perfectly on Linux as Apache, PHP & Linux filesystem use
same UTF-8...
Having this feature is useful for creating SEO-optimized sites with URLs
containing keywords. I don't ask to fix Unicode in general, but at least
for Windows, where it's known Apache will receive link as UTF-8 and pass
it as is to PHP, we can translate it into correct encoding before
calling system functions. I guess this is couple lines of code for
Windows build.
Reproduce code:
---------------
1. take any .php script and rename it to any name with UTF-8 2 byte+
symbols. I used russian íîâîñòè.php.
2. Configure Apache on Windows to use PHP as module (loadmodule)
3. Try to request this script from browser
Expected result:
----------------
Script won't load with 500 code. However, it runs when it's name has
only ASCII characters.
Actual result:
--------------
[error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening
required
'E:/www/test2/\xd0\x9d\xd0\xbe\xd0\xb2\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8.php'
(include_path='.;C:\\php5\\pear') in Unknown on line 0, referer:
http://test2.ru/
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50203&edit=1