PHP trace for Form post
A little background, I have a client that has a legacy php site that has been converted to python/django in the last 12 months. However they are still using the php site while phasing it out. Some new data is gathered in the old system and database structure from users still, but the clients would like it also to be available on the new site, which means inserting another mysql insert statement into the php 开发者_开发知识库code to write to the new site's database.
So the issue is the php developer is gone and not reachable. Also the code is a mess with multiple versions of each php file in multiple directories, zero version control. So I can find the code fragment that writes to the database, however it is in over 20 places. What I would love to be able to do is something comparable to the django, insert an 'assert Error' line in the form code upon POST and see the django error report traceback page, but this is php. So what are my best options here? Remember I am a python developer first and a php hack at best. Is there anything built into php that would allow me to see some type of traceback without too much hacking?
phptrace is a simple tool to trace php executing flows
$ ./phptrace -p 3130 -s # phptrace -p <PID> -s
phptrace 0.2.0 release candidate, published by infra webcore team
process id = 3130
script_filename = /home/xxx/opt/nginx/webapp/block.php
[0x7f27b9a99dc8] sleep /home/xxx/opt/nginx/webapp/block.php:6
[0x7f27b9a99d08] say /home/xxx/opt/nginx/webapp/block.php:3
[0x7f27b9a99c50] run /home/xxx/opt/nginx/webapp/block.php:10
If the MySQL server is version >= 5.0.2 then you could use triggers to keep the data up to date on the new site. That may prove easier than digging through all the PHP code (which you suggested you're not comfortable with).
精彩评论