我最近从apt-get在我的Ubuntu 12.10上安装了
PHP 5.4.
PHP信息显示:PHP版本5.4.6-1ubuntu1
我刚刚安装了所有常见的软件包,如MysqL,pgsql,curl等,没有做任何其他更改,但我有一个问题.
我喜欢在我的文件和数据库中使用ISO-8859-1 / latin1编码,因为它是我获得最佳工作流程的地方.现在我有一个问题,因为PHP似乎没有与其消息编码的异常相匹配.
那么,为了更好地澄清一下,我创建了一个这样的测试文件:
ini_set('display_errors',1);
error_reporting(E_ALL);
throw new Exception('é');
如果上面的代码是在一个utf-8文件,这一切都可以,Xdegub启用我得到:
( ! ) Fatal error: Uncaught exception 'Exception' with message 'é' in /home/henrique/public/teste.PHP on line 5
( ! ) Exception: é in /home/henrique/public/teste.PHP on line 5
Call Stack
# Time Memory Function Location
1 0.0002 124212 {main}( ) ../teste.PHP:0
如果文件在ISO-8859-1中,如果Xdebug已启用,问题只是该消息未显示:
( ! ) Fatal error: in /home/henrique/public/teste.PHP on line 5
( ! ) Exception: in /home/henrique/public/teste.PHP on line 5
Call Stack
# Time Memory Function Location
1 0.0002 124436 {main}( ) ../teste.PHP:0
但是,没有Xdebug,我得到的是这个“非常澄清”的消息:
Fatal error: in /home/henrique/public/teste.PHP on line 5
也许这是Apache内的一个问题,因为当我使用命令行尝试相同的时候,我得到:
Stack trace:
#0 {main}
thrown in /home/henrique/public/teste.PHP on line 5
Fatal error: Uncaught exception 'Exception' with message '�' in /home/henrique/public/teste.PHP on line 5
Exception: � in /home/henrique/public/teste.PHP on line 5
Call Stack:
0.0002 121256 1. {main}() /home/henrique/public/teste.PHP:0
消息仍然存在,但是,它是难以辨认,但是在那里…
编辑
我也尝试过Lighttpd 1.4.28,结果是一样的.
编辑2:
尝试使用PHP 5.4内置的服务器,并得到我的终端:
[Wed Jun 5 21:32:08 2013] PHP Fatal error: Uncaught exception 'Exception' with message '�' in /var/www/test2.PHP:9
Stack trace:
#0 {main}
thrown in /var/www/test2.PHP on line 9
[Wed Jun 5 21:32:08 2013] 127.0.0.1:55116 [200]: /test2.PHP - Uncaught exception 'Exception' with message '�' in /var/www/test2.PHP:9
Stack trace:
#0 {main}
thrown in /var/www/test2.PHP on line 9
但是在浏览器中,还是一样的问题.