I've installed PhpStorm hoping to debug a WordPress site running on my workstation on top of Local (https://localwp.com), which comes with an "Xdebug + PhpStorm" plugin I have installed.
The "zero configuration" has not worked for me. I set breakpoints and request a page in the browser but the breakpoints never get hit.
What else do I need to make this work?
Appendix I
PHP version 7.3.5
PhpStorm 2020.1.3
php.ini
[xdebug]
zend_extension = /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=Off
xdebug.remote_port="9000"
xdebug.profiler_enable=0
In order for PhpStorm / Local / Xdebug combo to work, you'll need to
Start Local
Install the addon for Xdebug from within Local
Restart Local
Start a site in Local (ie test)
Go to Utilities and click "Add run configuration to PhpStorm" (ignore the error that'll pop up)
Start PhpStorm and open ~/Local Sites/test/app/public/app/public . THAT'S IMPORTANT to open the public folder (that contains your WP root)
You'll see a "LOCAL" xdebug dropdown on the top right in PhpStorm
You're all set!
open /app/public from within PhpStorm
Related
I have a PHP file and I want to debug that file in Eclipse. I have heard about Xdebug as the best way to debug a PHP file in Eclipse.
What are the steps needed to be able to debug PHP files in Eclipse? I am using Windows OS.
Download PHP for eclipse (PLUGIN eclipse)
Use update URL
https://download.eclipse.org/tools/pdt/updates/7.0
Download XAMPP for windows and install it
https://www.apachefriends.org/es/download.html
Now you can follow alternative instructions here or continue to the next point where i explain what you need to do.
http://robsnotebook.com/php_debugger_pdt_xdebug
After installing XAMPP you should start Apache
Download Xdebug e.g http://xdebug.org/files/php_xdebug-2.9.2-7.2-vc15-x86_64.dll and check if it is correctly installed. Follow next instructions
1. Download php_xdebug-2.9.2-7.2-vc15-x86_64.dll.
2. Move the downloaded file to C:\xampp\php\ext
3. Update C:\xampp\php\php.ini and change the lines
[XDebug]
;; Only Zend OR (!) XDebug
; zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
; Modify the filename below to reflect the .dll version of your xdebug
zend_extension = C:\xampp\php\ext\php_xdebug-2.9.2-7.2-vc15-x86_64.dll
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1 ; if debugging on remote server,
; put client IP here
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="C:\xampp\tmp"
4. Restart the XAMPP webserver in your XAMPP control Panel
Comment out any Zend Optimizer in php.ini because it is not compatible with XDebug. For example, all of this should be commented out (using “;”):
[Zend]
; zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"
; zend_extension_manager.optimizer_ts = "C:\xampp\php\zendOptimizer\lib\Optimizer"
; zend_optimizer.enable_loader = 0
; zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
Check that it is working with phpinfo. You go to your browser and go to:
http://localhost/dashboard/phpinfo.php
Or create in your c:/xampp/htdocs
A file calling phpinfo e.g.
http://localhost/phpinfocall.php
Configuration PHP debug in eclipse
You can create a PHP project. That project should be pointint to C:\xampp\htdocs
The C:\xampp\htdocs is the localserver root folder in xampp. Inside you can create subfolders.
Configure PHP Preference of eclipse
Connect eclipse with php parser of xampp
Configure this and check that xdebug is detected in eclipse from xampp
How to create a debug view from a PHP file in your project
Debug view configuration below,
Lastly, you will see in the debug perspective, that the debugger stop automatically on the first line of your php file.
During the development on a Symfony 3.3 project I use the Symfony's internal server as seen there But I cannot figure out how to use the xdebug in order to debug it. I mean I have installed and configured xdebug via:
apt-get install php-xdebug
And I export:
export XDEBUG_CONFIG="idekey=phpstorm"
But when I put a breakpoint to my IDE and I enable the xdebug via that plugin I still get no response.
Also I have put the following settings on /etc/php/7.0/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9021
xdebug.remote_mode=req
And I have configured both PhpStorm to listen over port 9021. But I still get the problem that I cannot make PhpStorm to listen over a breakpoint.
Do you fellows have any sort of idea how I can fix that over my ubuntu-16.04 machine?
Furthermore I have looked on these questions without any success:
Xdebug configuration with PHP fastcgi and eclipse?
Is it possible to use Xdebug with the built in PHP test server?
EDIT 1
I also tried to export the following:
export XDEBUG_CONFIG="idekey=PHPSTORM"
An configuring the Firefox plugin but still get the very same behaviour. Also keep in mind that I made the PhpStorm to listen over xdebug by pressing the button.
EDIT 2
I also put the following configuration over my PhpStorm:
Still does not work.
In the end the following steps are needed:
Put the following content into: /etc/php/7.0/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9021
xdebug.remote_mode=req
Export:
export XDEBUG_CONFIG="idekey=PHPSTORM"
Then configure PhpStorm as the image shows.
Set as IDE key PHPSTORM into the Firefox plugin
Enable xdebug on Firefox via pressing the button. Alternatively you can append the url with ?XDEBUG_START part
Then press the button in PhpStorm. In case you see the then press it back again.
NOTE:
In case you change xdebug settings TERMINATE the xdebug session by pressing button and pressing back again.
Furthermore in case you run composer via terminal disable PhpStorm to listen xdebug by pressing button.
I'm on Windows and I'm trying to debug a Web application (hosted with Vagrant/Homestead) using PhpStorm through XDebug. I tried many configurations but I can't get things working. The PhpStorm XDebug setup is pretty common.
This is the current xdebug configuration:
vagrant#homestead: /etc/php/7.0/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey='PHPSTORM'
In the IDE "Start listening for PHP debug connections" it's turned on. When I attempt to start debugging a new chrome tab opens and the URL ends, for example, with ?XDEBUG_SESSION_START=16588 but the debugger doesn't run and this is what the IDE says:
Also, netstat says the port 9000 is still listening.
Any idea?
You are changing the 20-xdebug.ini file for the Command Line Interface (CLI). Instead you need to change the /etc/php/7.0/apache2/conf.d/20-xdebug.ini for the Apache settings, since you are using Chrome.
UPDATE
I'm not sure of the differences between Apache and Nginx (which may be /etc/php/7.0/fpm/conf.d/20-xdebug.ini), but here is how I got it working with a VirtualBox VM running Apache, on a Windows computer.
Settings for 20-xdebug.ini:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.1... (your windows IP address within your network)
xdebug.remote_port=9000
xdebug.autostart=1
I can't debug Symfony 3 with Netbeans.
I performed the following steps:
1) I installed php5-xdebug on ubuntu
2) I modified the php.ini file as follows:
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
3) I restarted apache
4) On Netbeans I set Run Configuration->Advanced->Do not Open Web Browser
5) I installed the easy Xdebug add-on for Firefox
6) I start the application with the console command php bin/console server:start
7) I put the breakpoint on the controller action with Netbeans
8) I start debug with Netbeans
9) I go on the url http://127.0.0.1:8000/shifts/1?XDEBUG_SESSION_START=netbeans-xdebug
Q - The page will load normally and debugging does not go on the breakpoint. Where am I wrong?
thanks
In order to debug your application using the PHP's built-in server follow the following steps:
In the tab "Projects" right-click on the project you wish to debug.
In the "Categories" list choose "Run Configuration".
In the "Run As" select box choose "PhP Built-in Web Server (running on built in web server)".
Add your Hostname and Port and press "OK".
Done with NetBeans IDE 8.2
My work setup is a Windows XP host, running an Ubuntu VM LAMP stack. I am using PhpStorm to edit my code on my host Windows machine. Upon saving files are automatically uploaded to the VM via SFTP. Everything works for this process, except debugging.
I have setup PhpStorm to have a server named "UbuntuVM" with the following settings:
Debugger:
- XDebug
Debug session settings:
- Break at the first line
- Wait for connection with ide key: XDEBUG_PHPSTORM
Before launch:
- Upload files to selected server
I am using Chrome with Xdebug Helper, and have set the extension to use "Other" as the IDE, with "XDEBUG_PHPSTORM" as the key.
The VM has the following in the php.ini:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=10.1.6.22
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.collect_params=On
xdebug.show_local_vars=On
When I set a break point in my IDE, enable the debugger in Chrome, and reload the page, I never hit the break point; and the IDE says "Waiting for connection on port 9000 with ide key 'XDEBUG_PHPSTORM'".
Does anyone have any idea why I'm not hitting my break points?
Comes to find out that xdebug.remote_host isn't needed, rather, use xdebug.remote_connect_back=1.