#50203 [NEW]: Apache +mod_php can't load script with non-ASCII name
From: vadim at sukhomlinov dot ru
Operating system: Windows XP SP3
PHP version: 5.3.0
PHP Bug Type: *General Issues
Bug description: Apache +mod_php can't load script with non-ASCII name
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 bug report at http://bugs.php.net/?id=50203&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50203&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50203&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50203&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50203&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50203&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50203&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50203&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50203&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50203&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50203&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50203&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50203&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50203&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50203&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50203&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50203&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50203&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50203&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50203&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50203&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50203&r=mysqlcfg
Thread (7 messages)
- vadim at sukhomlinov dot ru