I have a very messy PHP script of which I need to determine the function. I can't quite understand the code, it's really messy. Now I thought that I perhaps could reverse engineer this script.
What I want to do is to run this script (eventually with specific parts commented) to gain a better understanding of what part of the script does what. With that information, I should be able to get a full understanding of the script.
However, I do not want to change anything in the database on the server, I do not want that the script is going to mail things, etc. Basically, the script should be totally separated from the world, but I do want to see what it tries to do. So, for example, when the script runs a
mail() function, I want to see that a mail would've been sent if the script wasn't separated from the world.
I therefore need a copy of the server installation (Ubuntu Server 12.04), which isn't that hard. The hard part is that I need to have a system which acts like it is the outside world, but actually is a logging system in which I can see what's happening.
Are there any tools that can do this? If not, how should I go in building it myself?