我需要debuggingPHP。我最好的select是什么?

我需要debuggingPHP。我最好的select是什么?,第1张

概述我需要debuggingPHP。 我最好的select是什么?

我正在linux环境下的一个网站上工作(Debian)。 我不是linux的专家,但我可以处理它,而且网站是使用PHP,MysqL,HTML等制作的。

事情是,我在服务器端使用PHP。 现在,为了testing,我在我的PC上安装了Apache,这样我就可以testing一切。 但是,如果我可以deBUGgingPHP代码,那将是非常好的。 到目前为止,我不需要它,但现在代码越来越大,这是必须的。

到目前为止,我使用vim,一切都很好,但是,我怎么能在我的情况下deBUGgingPHP? 我应该安装哪些工具? 他们有空吗?

基本上,我需要知道什么是我的情况下的最佳select。

以编程方式添加Java应用程序启动

configuration错误在Ubuntu上安装R-3.3.2:检查是否支持bzip2 … configure:error:需要bzip2库和头文件

hibernate – 在linux和windows上的不同行为

XDeBUG提供了一步一步的调试,可以和eclipse PDT,netbeans甚至vim一起使用。 你真的应该试一试。 还有Zend DeBUGger。

您可以使用调试工具来安装PHP IDE。 它将帮助您逐步调试您的PHP代码。

很少有这个功能的流行:

Eclipse (请参阅: 使用Eclipse调试PHP? )

NetBeans的

NuSphere的PHPED (仅适用于 windows)

对于更高级的解决方案,您可以手动为PHP安装XDeBUG扩展。

默认情况下,当加载XDeBUG时,如果有任何致命错误,应该自动显示回溯。 或者你跟踪到文件(xdeBUG.auto_trace)有一个非常大的整个请求的回溯或执行分析(xdeBUG.profiler_enable)或其他设置 。 如果跟踪文件太大,可以使用xdeBUG_start_trace()和xdeBUG_stop_trace()来转储部分跟踪。

安装

使用PECL:

pecl install xdeBUG

在linux上:

sudo apt-get install PHP5-xdeBUG

在Mac(与自制软件):

brew tap josegonzalez/PHP brew search xdeBUG PHP53-xdeBUG

配置示例:

[xdeBUG] ; Extensions extension=xdeBUG.so ; Zend_extension="/YOUR_PATH/PHP/extensions/no-deBUG-non-zts-20090626/xdeBUG.so" ; Zend_extension="/Applications/MAMP/bin/PHP/PHP5.3.20/lib/PHP/extensions/no-deBUG-non-zts-20090626/xdeBUG.so" ; MAMP ; Data xdeBUG.show_exception_trace=1 ; bool: Show a stack trace whenever an exception is raised. xdeBUG.collect_vars = 1 ; bool: Gather information about which variables are used in a certain scope. xdeBUG.show_local_vars=1 ; int: Generate stack dumps in error situations. xdeBUG.collect_assignments=1 ; bool: Controls whether XdeBUG should add variable assignments to function traces. xdeBUG.collect_params=4 ; int1-4: Collect the parameters passed to functions when a function call is recorded. xdeBUG.collect_return=1 ; bool: Write the return value of function calls to the trace files. xdeBUG.var_display_max_children=256 ; int: Amount of array children and object's propertIEs are shown. xdeBUG.var_display_max_data=1024 ; int: Max string length that is shown when variables are displayed. xdeBUG.var_display_max_depth=3 ; int: How many nested levels of array/object elements are displayed. xdeBUG.show_mem_delta=0 ; int: Show the difference in memory usage between function calls. ; Trace xdeBUG.auto_trace=0 ; bool: The tracing of function calls will be enabled just before the script is run. xdeBUG.trace_output_dir="/var/log/xdeBUG" ; string: Directory where the tracing files will be written to. xdeBUG.trace_output_name="%H%r-%s-%t" ; string: name of the file that is used to dump traces into. ; Profiler xdeBUG.profiler_enable=0 ; bool: Profiler which creates files read by KCacheGrind. xdeBUG.profiler_output_dir="/var/log/xdeBUG" ; string: Directory where the profiler output will be written to. xdeBUG.profiler_output_name="%H%r-%s-%t" ; string: name of the file that is used to dump traces into. xdeBUG.profiler_append=0 ; bool: files will not be overwritten when a new request would map to the same file. ; Cli xdeBUG.cli_color=1 ; bool: color var_dumps and stack traces output when in Cli mode. ; Remote deBUGging xdeBUG.remote_enable=off ; bool: Try to contact a deBUG clIEnt which is Listening on the host and port. xdeBUG.remote_autostart=off ; bool: Start a remote deBUGging session even GET/POST/cookie variable is not present. xdeBUG.remote_handler=dbgp ; select: PHP3/gdb/dbgp: The DBGp protocol is the only supported protocol. xdeBUG.remote_host=localhost ; string: Host/ip where the deBUG clIEnt is running. xdeBUG.remote_port=9000 ; integer: The port to which XdeBUG trIEs to connect on the remote host. xdeBUG.remote_mode=req ; select(req,jit): Selects when a deBUG connection is initiated. xdeBUG.IDekey="xdeBUG-cli" ; string: IDE Key XdeBUG which should pass on to the DBGp deBUGger handler. xdeBUG.remote_log="/var/log/xdeBUG.log" ; string: filename to a file to which all remote deBUGger communications are logged.

如果您使用apache作为您的web服务器,那么您可以使用apache日志来查看任何错误,以防止成功执行PHP脚本。

你可以使用

tail -f /var/log/apache2/error.log

查看apache日志,这将做的工作(至少为PHP相关的错误的一个子集)。

具体来说,如果你是(像我这样的新手,在第一次使用PHP开始之后发现了这个线程),首先尝试找出产生错误消息的原因,首先从error_log开始。 这是将字符串作为“错误消息发送到Web服务器的错误日志或文件”的函数。

一般来说,要了解PHP中错误报告和配置的基本原理,首先从PHP.net上的错误处理函数文档中的函数开始 – 该页petrov dot michael () gmail com的评论由petrov dot michael () gmail com是一个有用的开始。

要实际生成错误,作为新手(最少量文档读取)的最佳选择是从print_r开始。 将print_r的第二个参数设置为TRUE将返回一个字符串,然后您可以将其传递给error_log 。 这可能是最快捷的调试方式,因为你的PHP代码可能位于某个框架内部,并添加到各种输出控制层(如wordpress)中。

如果你的电脑 *** 作系统是windows,那么最简单的方法是使用任何Web开发堆栈(WAMP,XAMPP)的CodeLobster免费版我发现设置CodeLobster进行调试非常容易(与eclipse或netbeans相比)CodeLobster的安装是非常小的比较到其他IDE,而且它的免费版本支持全面的调试功能。

你可以找到详细的一步一步的指导如何在后面安装它如何调试PHP – 简单的方法

总结

以上是内存溢出为你收集整理的我需要debuggingPHP。 我最好的select是什么?全部内容,希望文章能够帮你解决我需要debuggingPHP。 我最好的select是什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1290411.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存