Attach Eclipse php debugger to Apache server - php

I have built an app that sends requests to a server.
I also built a server to response those requests. I have a PHP server locally (LAMP).
Now, for debug purposes , I want to debug the requests that my app is sending to the server. But I don't want to do that separately (printing the app's request and than start debug the server with that request),
I want eclipse (PDT installed and xdebug) to stop at the first line of the PHP script running by the server WHEN the app is sending a request to the server.
How can I do that ?

Related

AWS EC2 server refusing Ionic/Capacitor/Android connections to PHP files

I have recently begun building an Angular Ionic app which connects to PHP scripts on an AWS EC2 server. Everything works fine except for when I try to connect through Android once the app is built on my phone.
The response is a simple 404 response with no additional information. When I look at the log on Android Studio I see the following response:
E/Capacitor: Unable to open asset URL: [api address]
I have reduced both the HttpClient call on the frontend and the php file on the backend to their most simple forms and yet still nothing:
<?php
echo "Hello";
?>
I know that Capacitor was updated to 3 only a couple of months ago and am concerned that it is related to that. I am using PHP 7.
UPDATE
The issue was indeed cleartext but the issue was made more complicated by the fact that HttpClient was not catching the error and so I was simply getting back an unknown failed response.
In order to first see that it was cleartext I first had to change HttpClient for the Native HTTP plugin and check the logs whilst testing on my phone (HTTP will not work through the browser).
Only then did I notice that I hadn't changed the config file correctly.
As long as your PHP web server is not running on the Android device directly trying to connect to localhost / 127.0.0.1 won't work and you need to use another domain / IP your web server is available on and which the Android device can access. You can also check this by simply opening the URL in the browser of the Android device.
If that is not feasible for you you could also use port forwarding via adb to forward a port of your web server to a local port on the Android device.
If you use another domain / IP make sure your web server is not listening to local connections only and is not blocked by a firewall or similar.
Also if you are using an unencrypted connection (i.e. http instead of https) you might need to enable the cleartext config option in you Capacitor config.

Monitor http traffic going from localhost wordpress on Fiddler

I want to monitor all HTTP requests going to the internet from a locally deployed Wordpress instance (on XAMPP server) on Fiddler. I guess I may need to configure XAMPP (or php specifically) to route all the requests going from it to the internet via Fiddler proxy but I am not sure how to do that. Has someone done this before?
Flow:
1. Wordpress (on a local XAMPP instance) makes an ajax call to the internet via a plugin.
2. I want to check the HTTP request and response for debugging.
3. I configured Fiddler to monitor localhost traffic but that does not show me requests sent by XAMPP.
4. Stuck!

Unable to debug PHP API from an Android Client

I am trying to debug my PHP API (XDebug + PHPStorm configurated and working correctly) calling it from an Android application.
I have enabled remote debug in PHPStorm and if I do a request from, for example, Postman, PHP Storm stops on the selected breakpoints.
However, when the Android app (in debug mode) do a request to php server (with PHPStorm opened), the Android app gets the response but it does not stop on breakpoints.
Why?
Thanks
You need your Android application to make requests with the XDebug cookie set. This, in case you've configured XDebug to allow debugging from different IP addresses other than the local Development Box.

Web service PHP + Android application

Using eclipse i create a simple abdroid application which communicate with MYSQL data base using PHP scripts, i start writing my PHP Web Service and i put those files under 'www' of my Wamp server.
in fact Wamp server is using two servers
1.web server ( Apache)
2.Mysql
after doing those steps i run my android application under eclipse ide and i get all things works..
I m trying to understand the process behind all that.
My Android application by runnig send an HTTP request to the PHP web service, then ,the apache Web server in Wamp Server executes the php script and do some oparation on the data base ,after that the result is reterning to the Android application ( the result in Json format), and finaly the application decode the Json object and display the result
is it right? please correcte me if i m wrong
This is correct if you want it to be a simple request-driven web service (such as HTTP in your case).

Capturing outgoing traffic from localhost MAMP using Wireshark

I'm trying to capture outgoing SOAP (over HTTP) requests generated by one of my PHP scripts (being run on my localhost). I'm running MAMP and using the PHP NuSOAP library for sending the request, I filter to HTTP traffic in Wireshark but nothing shows up when I run the script (which is sending a SOAP request to an external server via HTTP). Any ideas?
Thanks

Categories