回答
我做了几个快速测试(有没有与HIPHOP的,因为我想,遗憾的是尽可能多玩的时间; - ();这里是我得到的结果:
首先,这里有test-2.php
的内容,其中包含了解析错误:
<?php
echo "what with a parse error ?
注:该字符串没有完成
试图运行与PHP,我得到:
$ php test-2.php
PHP Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /home/squale/temp/hiphop-php/tests/test-2.php on line 5
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /home/squale/temp/hiphop-php/tests/test-2.php on line 5
试图编译与嘻哈,我得到:
$ /home/squale/temp/hiphop-php/hiphop-php/src/hphp/hphp test-2.php --keep-tempdir=1 --log=3
running hphp...
creating temporary directory /tmp/hphp_JdsWcU ...
parsing inputs...
parsing ./test-2.php...
parsing inputs took 0'00" (0 ms) wall time
running hphp took 0'00" (154 ms) wall time
Exception: Unable to parse file: ./test-2.php
(Line: 5, Char: 0): syntax error, unexpected $end
即具有解析错误的文件不会编译 - 这是理由。
错误消息有一些信息是存在于PHP的错误信息 - 但不完全一样精确...
这意味着你可能要尝试与嘻哈编译应用程序之前与PHP尝试: PHP给出的错误信息更具描述性。
现在,让我们尝试一些运行时错误/警告;这里有test-1.php
内容:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
if ($_GET['test'] == '1') {
$data = (object)array(10);
echo $data[0];
} else if ($_GET['test'] == '2') {
echo 10/0;
} else if ($_GET['test'] == '3') {
file_put_contents('/bin/non-allowed', 'hello !');
}
echo "plop\n";
试图运行Apache的+ PHP这个文件,你会得到三个可能的错误:
(我的文件复制到我的文档根目录 - 这意味着该路径将不适合与Apache的错误)
首先一样,调用http://localhost/temp/test-1.php?test=1
我得到:
Fatal error: Cannot use object of type stdClass as array in /home/squale/developpement/tests/temp/test-1.php on line 8
而且,试图http://localhost/temp/test-1.php?test=2
我得到:
Warning: Division by zero in /home/squale/developpement/tests/temp/test-1.php on line 10
plop
最后,与http://localhost/temp/test-1.php?test=3
,我得到:
Warning: file_put_contents(/bin/non-allowed) [function.file-put-contents]: failed to open stream: Permission denied in /home/squale/developpement/tests/temp/test-1.php on line 12
plop
现在,在编译test-1.php
文件,嘻哈和网络服务器模式下运行它,我得到这个在编译阶段,这意味着它是好的:
$ /home/squale/temp/hiphop-php/hiphop-php/src/hphp/hphp test-1.php --keep-tempdir=1 --log=3
running hphp...
creating temporary directory /tmp/hphp_xXZ8US ...
parsing inputs...
parsing ./test-1.php...
parsing inputs took 0'00" (1 ms) wall time
pre-optimizing...
pre-optimizing took 0'00" (0 ms) wall time
inferring types...
inferring types took 0'00" (0 ms) wall time
post-optimizing...
post-optimizing took 0'00" (0 ms) wall time
creating CPP files...
creating CPP files took 0'00" (32 ms) wall time
compiling and linking CPP files...
compiling and linking CPP files took 0'39" (39807 ms) wall time
running executable /tmp/hphp_xXZ8US/program --file test-1.php...
plop
all files saved in /tmp/hphp_xXZ8US ...
running hphp took 0'40" (40054 ms) wall time
然后,启动服务器:
$ /tmp/hphp_xXZ8US/program -m server -p 8080
Could not mlockall
loading static content...
loading static content took 0'00" (0 ms) wall time
page server started
admin server started
all servers started
现在,让我们尝试访问这些三个URL;第一,呼吁http://localhost:8080/test-1.php?test=1
我得到:在浏览器
Unhandled error: Invalid operand type was used: not ArrayAccess objects.
在控制台从我开始在服务器对于http://localhost:8080/test-1.php?test=2
- 没什么,我得到:
- 在浏览器:
plop
- 在我开始的控制台编辑浏览器:
Division by zero
最后,对于
http://localhost:8080/test-1.php?test=3
,我得到:- 在浏览器:
plop
- 在控制台:什么
这里,同样,错误的迹象也不像PHP那么好......至少在默认选项中......
从嘻哈的Runtime options wiki page判断,您可以指定包含某些选项的配置文件。
这是我使用的config.txt
的内容:Log { Level = Verbose NoSilencer = true AlwaysLogUnhandledExceptions = true RuntimeErrorReportingLevel = 6143 Header = false InjectedStackTrace = true NativeStackTrace = true MaxMessagesPerRequest = -1 } ErrorHandling { CallUserHandlerOnFatals = true NoInfiniteLoopDetection = false NoInfiniteRecursionDetection = false MaxStackDepth = 1000 ThrowBadTypeExceptions = true ThrowNotices = true NoticeFrequency = 1 # 1 out of these many notices to log WarningFrequency = 1 # 1 out of these many warnings to log AssertActive = false AssertWarning = false }
重新启动服务器,使用--config
开关指向该文件:$ /tmp/hphp_xXZ8US/program -m server -p 8080 --config=config.txt Could not mlockall loading static content... loading static content took 0'00" (0 ms) wall time page server started admin server started all servers started
我应该得到更多的信息..让我们再次尝试我们的三个要求。
首先,调用
http://localhost:8080/test-1.php?test=1
我得到:以前 - 在浏览器:
对于http://localhost:8080/test-1.php?test=2
- 一样,我得到:
- 同 前
最后,对于
http://localhost:8080/test-1.php?test=3
,我得到:- 在浏览器:
plop
- 在控制台:我没有得到一个新的错误消息之前:
f_file_put_contents/316: Permission denied
我没有尝试更多,但玩配置文件和--config
开关看起来像一个有趣的想法;-)
注:我做了Ubuntu 9.10的64位这些测试 - 这是一个正式支持系统;安装非常简单。
这意味着你可以尝试这些,在虚拟机中进行安装,例如:只要你对Linux和编译软件了解一些,安装hiphop并不是不可能完成的任务。
这是一个很棒的答案!谢谢你,伟大的工作 – 2010-03-19 19:29:22
不客气:-) *(我一直计划编译hiphop很长一段时间......现在已经完成了,而且我已经有了第一步的乐趣,我可以拥有一些更有趣的测试它多一点^^)* – 2010-03-19 19:31:58
很好的答案!非常想尝试HipHop – 2011-04-08 22:14:30
- 1. hiphop-php编译错误
- 2. PHP HipHop与PHP FastCGI
- 3. PHP会发生什么用 - >
- 4. 为什么会发生URL错误?
- 5. 错误CS1525为什么会发生?
- 6. http请求中发生的ENOTFOUND错误,意味着什么?
- 7. “随机”发生的错误
- 8. 当发生javascript运行时错误时会发生什么?
- 9. 使用Hiphop进行PHP扩展开发
- 10. Apache和HipHop for PHP的基准PHP?
- 11. $这意味着什么PHP?
- 12. 什么===在PHP意味着
- 13. 为什么有些PHP错误不会写入PHP日志中?
- 14. 这个错误是什么,为什么会发生?下面
- 15. 发送邮件时发生PHP错误
- 16. PHP CodeIgniter会话库 - 长“sess_time_to_update”会发生什么坏事?
- 17. 评估nil.dependencies意味着什么发生了错误?
- 18. 什么可能导致这个PHP错误? PHP中的错误?
- 19. 我的php代码发生了什么?
- 20. Php的set_time_limit会引发500错误?
- 21. C++,尾随逗号不是一个错误,会发生什么? Foo x,y ,;;
- 22. 一旦实例化了PHP中的类,会发生什么?
- 23. 会发生什么?
- 24. 会发生什么?
- 25. 会发生什么?
- 26. 在Windows中运行HipHop PHP
- 27. HipHop-Php虚拟机和auto_prepend
- 28. 预计会发生块错误,我做错了什么
- 29. PHP会话错误
- 30. PHP:会话错误
检查文档,它可能在那里(我不知道,但它似乎是最简单的方法)。 http://wiki.github.com/facebook/hiphop-php/hiphop-documentation – Piskvor 2010-03-10 12:03:40
我想像很多PHP错误成为编译器错误。其余的可能在运行时失败。 – 2010-03-16 02:22:20
我想你只能在开发完成后编译php。但有趣的是看他们如何处理运行时错误 – antpaw 2010-03-17 19:23:53