search
Homephp教程php手册小技巧找出一个php的cron脚本出问题的代码行

这个小技巧虽然很小,但是很有用。 我写了一个cron脚本,但是隔一天发现,这个昨天的cron脚本还一直在跑着,没有停下来,一定是里面有个程序堵住了。 但是如果我重新跑又需要很多时间。这个怎么办? 现在最需要就是要知道程序停在了那行代码上了。使用gdb:

这个小技巧虽然很小,但是很有用。

 

我写了一个cron脚本,但是隔一天发现,这个昨天的cron脚本还一直在跑着,没有停下来,一定是里面有个程序堵住了。

但是如果我重新跑又需要很多时间。这个怎么办?

 

现在最需要就是要知道程序停在了那行代码上了。使用gdb:

 

$sudo gdb -p <span>14973</span><span> 
(gdb) print (</span><span>char</span> *)executor_globals.active_op_array-><span>filename 
$</span><span>1</span> = <span>0x9853a34</span> <span>"</span><span>/home/xinhailong/test/php/test.php</span><span>"</span><span> 
(gdb) print (</span><span>char</span> *)executor_globals.active_op_array-><span>function_name 
$</span><span>2</span> = <span>0x9854db8</span> <span>"</span><span>test1</span><span>"</span><span> 
(gdb) print executor_globals</span>->current_execute_data->opline-><span>lineno 
$</span><span>3</span> = <span>4</span>

 

好了,我们就知道了,这个程序停在了/home/xinhailong/test/php/test.php文件的第4行代码中的test1函数内。

于是就能进行后续的分析了。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)