How do I debug this using VS.PHP?
I have a server side PHP script I am working on in VS.PHP in VS 2005 using VS.PHP 2.4 version. In my PHP script I need to use $_POST to read a small xml string that is sent to the server using another PHP script from the command prompt and PHP CLI as follows:
This is the snippet of the client PHP script I want to run from the CLI interface:
$url = "https://localhost/test.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "dtype=$query");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$reply = curl_exec($ch);
if($reply == NULL) {
echo "Error:\n";
echo "curl_errno" . " - " . curl_error($ch) . "\n";
}
curl_close($ch);
print_r($reply);
$query variable above in dtype=$query holds a small well formed xml string.
In test.php which will be on the server Apache, but for now I want to run in VS.PHP on VS 2005 so I can debug so I will have:
$xml = $_POST[????];
?
In other words what do I need above in the $_POST to read this xml sent in the $query variable above and how to I set a break point and debug - I'm confused about how to do this best or at all for that matter?
Thanks for any tips and suggestions.
Neal D.


If I understand correctly,
If I understand correctly, you want to debug the request made by the cli php script.
The best way to do this is by using XDebug and adding this entry to the php.ini file:
xdebug.remote_autostart=1
This will start the debug session in all requests. Make sure XDebug is configured to point to your machine IP address using:
xdebug.remote_host
Another option is to change the request url in the CLI script to start the debug session. If you create a simple project and use XDebug or DBG you will see the query string VS.Php adds to the request. You'd need to do the same.
Check this tutorial as an example:
http://www.jcxsoftware.com/jcx/vsphp/tutorials/dotnet_debugging
Good luck!
debug both client and server in PHP
I have set up a project just like the tutorial on debugging the dotnet C# example you provided. My client is PHP not C# and my server is PHP.
However I get the following error when I set a break point in my client so that I can step into it and then step into the server.
Error detect:
==> error code: 10048
==> error message: error calling bind():
A process on the machine is already bound to the same
fully-qualified address and the socket has not been marked
to allow address re-use with SO_REUSEADDR. For example,
IP address and port are bound in the af_inet case
Basically this is my client code that sends a small well form xml string to the server as shown
-------------------------------------------------------------------------
$url = "http://localhost/SiliconViewWs/svws_main.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$reply = curl_exec($ch);
My server is simply waiting with a $_POST or
$xml = file_get_contents("php://input");
to read the XML string in the request
Any ideas what I'm doing wrong? Thanks
Are you debugging the server
Are you debugging the server using the built-in engine or in external mode (your server)?
Are you starting more than one debug instance of VS.Php?
debug both client and server in PHP
I want to debug both the client and the server. Both client and server are written in PHP. I want to debug just like the the tuturial shows with PHP and .NET in one VS 2005 project. I have set my settings just like the tutorial shows. But I am receiving the following error:
Error detect:
==> error code: 10048
==> error message: error calling bind():
A process on the machine is already bound to the same
fully-qualified address and the socket has not been marked
to allow address re-use with SO_REUSEADDR. For example,
IP address and port are bound in the af_inet case
How do I setup VS.Php just like to tutorial so I can debug both client and server in one project.
Thanks if you can give more details.
Neal
Go to the project properties
Go to the project properties of each server and assign a different port to Apache to listen to. It seems that you are currently starting two instances of Apache and both are trying to use the same port.
Make sure the url from the client php matches the port you assign to the server.
Good luck