We help IT Professionals succeed at work.

Visual Studios: How config so debugger will start when the php script is called by an executable?

Using Visual Studios 2013 with PHP Tools: trying to debug a php project where a php script is called by an executable.  Both the executable and the php project are on my PC.  How do I configure so that the debugger will start when the php script is called by the executable?
Comment
Watch Question

Top Expert 2015

Commented:
Is it calling PHP.EXE or via libraries?

Author

Commented:
Aha!  That got me thinking:  by default, VS PHP Tools uses php built-in webserver.  Yet the executable... well, I'm not quite sure how that works... I suspect it would use whatever the default web server is on W7 to initiate an http session (I think that's the correct terminology?), which would be Apache.  

I have multiple Apache installs/configs, so I can choose either a config that uses Apache PHP module (is that what you meant by "via libraries"?) or using FastCGI (php-cgi.exe).

Any thoughts on how to proceed?
David Johnson, CDSimple Geek from the '70s
Distinguished Expert 2019

Commented:
no it will use iis express by default. add both to your solution

Author

Commented:
Thanks David; I suspect it will use iis express by default if I weren't using PHP Tools.
Top Expert 2015

Commented:
Normally one loads some php debug module into php that is loaded either way in any supported webserver. I just asked because if you call php.exe or load libphp in some VS application things get more complicated.

Try to get phpinfo() from your PHP - it must show some VS debug module loaded.
VS PHP Tools uses xdebug; however, it doesn't require anything other than the php built-in webserver (i.e. I can stop my Apache service and still debug my script).  Of course, if I need a web server for non-debug related operations (e.g. receiving an http request from another application), then that is where Apache comes into play.

I've figured out how to config the php project in VS:

Set the Start Action to: Don't Open a Page: Wait for a request from an external application.

Use Custom Web Server -> Server URL: http://localhost/<folder that contains the called php script>

Thanks everyone for your help--

Author

Commented:
Found solution myself