I'm pretty desperate and running out of ideas:
I've configured xdebug and PhpStorm for a Laravel 3 project. Running the project locally on Mac OS X Apache, so PhpStorm and the web application run on the same machine. Configured a virtual host so that localhost.lt points to Laravel's public directory.
Relevant xdebug entries in php.ini:
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
[xdebug]
xdebug.idekey="PHPSTORM"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_log=/var/log/xdebug_remote.log
xdebug.remote_connect_back=1
Confirmed that extension gets loaded.
Set up a PHP Web Application debug / run configuration without any path mappings as nothing is symlinked and the folders on the web server and for PhpStorm are exactly the same (as the web server is on the same machine).
When launching via "Debug" from the IDE, xdebug_remote.log correctly shows the breakpoint we've set in one of the files in application/libraries:
<- breakpoint_set -i 5 -t line -f
file:///Users/RalfR/src/livetime/application/libraries/LiveTime.php -n 676
->
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="9230016"></response>
However, when we click a link that invokes the function from the LiveTime.php library, the breakpoint is NOT hit. The log shows:
<- stack_get -i 6 ->
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="6"><stack where="{main}" level="0" type="file" filename="file:///Users/RalfR/src/livetime/public/index.php" lineno="14"></stack></response>
<- run -i 7 ->
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="7" status="stopping" reason="ok"></response>
<- run -i 8
Log closed at 2013-04-22 21:03:57
As many frameworks, Laravel uses .htaccess mod_rewrite to pipe everything through public/index.php. May this be the cause for PhpStorm / xdebug not catching the breakpoint in application/libraries/LiveTime.php as it appears to xdebug that the LiveTime.php script is never executed?
If so, how can we solve this problem?
When the debugger cannot connect or refuses the connection, check the following: Make sure Xdebug or Zend Debugger are configured to connect to the host and port PhpStorm is running on. In the Xdebug configuration, make sure xdebug. remote_host and xdebug.
PhpStorm supports the use of Xdebug in the Just-In-Time (JIT) mode so it is not attached to your code all the time but connects to PhpStorm only when an error occurs or an exception is thrown. Depending on the Xdebug version used, this operation mode is toggled through the following settings: Xdebug 2 uses the xdebug .
Verify that Xdebug is properly running by checking again with phpinfo() or php -v as explained above. Note that 9003 is the default port. If this port is used by another service on your system, change it to an unused port. After adding these settings, restart your webserver again.
XDebug works over the protocol that requires your local machine to listen for incoming connections from a server where an application you are debugging is located. You may already have used debugging tools that simply connect to a remote server or a process of your application.
For those who are using Netbeans and Laravel, you need to set the "Web Root" as your public folder which located in your project->Properties->Sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With