PHP Xdebug Netbeans Breakpoints - php

After working fine, with no config changes for months xdebug/netbeans is now useless.
I can create breakpoints but whenever it has 'stepped in' to a further scope its impossible to step thru and simply jumps out of the inner scope to the caller.
There are no exceptions generated.
Using tail -f xdebug.log shows breakbpoints being correctly created / removed, Netbeans failed to remove from Ubuntu Software Centre, however I reinstalled over the top of existing. This does not seem clean as Netbeans remembered settings.
Latest steps:
Ran instructions at https://xdebug.org/wizard.php and rebooted webserver
Of note here it recommended install of xdebug-2.4.1 instead of previously 2.4.0 however this made no difference to current state of NetB / Xdebug combo. I checked php-fpm ini and this correct phpized version still ?
Ran uninstall.sh at /usr/local/netbeans8.*
Downloaded re-install at http://www.oracle.com/technetwork/articles/javase/jdk-netbeans-jsp-142931.html (I also need Java JDK so this is ideal)
Made it executable and ran installer (as sudo)
chmod +x jdk-8u101-nb-8_1-linux-x64.sh;
./jdk-8u101-nb-8_1-linux-x64.sh;
And nothing changes - this is very frustrating that software designers still cannot be a***d to create proper uninstallers. Still same settings prior to re-install.
Further
Closed NetBeans again
cdl /home
then check in each user dir
rm -r .netbeans
rm -r NetBeansProjects
There was also a directory called nbproject near the site root directory and in the sitefiles repo which is gitted - these was removed.
Update
Now set up the project including the crap Netbeans debug 'stop at first line' and allowing watches (whats the point of these defaults in a generally used framework norm such as laravel and what is debugging without being able to look at variable values).
Its now begun allowing stepping thru code but after closing debug session will now not allow access to run config. Had to close all projects and reopen.
This proves that its a Netbeans issue.

Seems the problem went - maybe on IDE update ?

Created (with a struggle as continually no drop down options) I managed to add a few more debug urls. Its still not possible to do this directly as before so presume Netbeans has done some sort of 'breakit update'.
Testing the URLs in debug mode shows them all to step thru PHP properly now.
To change the URL is now an un-intuitive chore of selecting the project first in the projects tab and hoping to catch it in the drop down.
Therefore since re-install of xdebug showed it the project still broken, then complete manual re-install of the botched uninstall by the actual Netbeans app now shows it working it can only be confirmed that Netbeans is at fault. Shame - I have used Netbeans for years, but for it to cost me 2 days is a liability. Anyone know if Eclipse has improved speed wise ?

Related

PhpStorm 2020.2 - PHP Built-in functions are not recognized

I just installed PhpStorm 2020.2, and notice that all php base classes like Closure or mysqli are not been identified by the IDE.
Looking at the left where the PHP base files are, it just show the folders, like you can see in the first image, on the other hand, my older PhpStorm 2017 has the folders with the files inside it and cant identify all php base classes
PhpStorm 2020.2
PhpStorm 2017
It's a known issue. AFAIK there is still no solid idea on why it happens and why only some users are affected.
https://youtrack.jetbrains.com/issue/WI-54626 -- watch this ticket (star/vote/comment) to get notified on any progress. Fixed in PhpStorm 2021.1.1 version.
Current workaround:
Close IDE
Locate folder where PhpStorm 2020.2 stores indexes/caches on your computer (see below)
Delete that folder (as standard "Invalidate caches" does not help here)
Launch IDE
Typical locations for caches folder for different OS:
Windows: %USERPROFILE%\AppData\Local\JetBrains\PhpStorm2020.2\caches
Linux: ~/.cache/JetBrains/PhpStorm2020.2/caches
macOS: ~/Library/Caches/JetBrains/PhpStorm2020.2/caches
For 2021.1 version: use File | Invalidate Caches... -- it now better clears them so no need to delete such folders manually.
File | Invalidate Caches...
Select top 2 options (maybe only 1st will be enough, but better use both)
Use Invalidate and Restart button there
After the IDE will restart, open the project and let re-indexing to complete.
If the issue persists (i.e. comes back the next day / after restart) then it's a different cause and you will have to wait for 2021.1.1 build.
Before doing all that #lazyone has said 👌, make sure that the Phpstorm php interpreter is set correctly. You can check that from here:
File/settings/languages & frameworks/php/

How can I step-debug a drush command with ddev and PhpStorm?

I need to debug a drush command in a ddev project, but I don't know how to do it. In ddev v0.18.0, the PhpStorm debugger breaks at the beginning, but it can't find the associated code.
Updated 2020-12-28: This answer is obsolete since ddev already sets the PHP_IDE_CONFIG environment for you in recent versions. In general, if you've done any debugging already (which creates the .ddev.site "server"/mapping) then things should just work. Some people also prefer to use vendor/bin/drush as that skips the use of /usr/local/bin/drush, which is Drush launcher.
------- Original Answer -------
PHPStorm provides a very nice way to do this, and ddev makes it super easy with the automatic debugging setup.
This technique works best for a Drupal 8 site with drush vendored in, like you get with drupal-composer setups. It assumes that drush is vendored into vendor/drush/drush.
This PHPStorm blog post explains the technique.
Create a server in PHPStorm (Project settings->Servers). My "server" name is d8composer. It doesn't matter what you call it, you just need to use it later.
In the PHPStorm server configuration, map your host project directory to /var/www/html:
Click the "Listen for Debug Connections" button.
Click a breakpoint at a place you know should be hit by your drush command.
Inside the container (ddev ssh), export PHP_IDE_CONFIG="serverName=d8composer" - Yours will be named something other than d8composer of course.
Inside the container /var/www/html/vendor/drush/drush/drush uli (or whatever command you want). PHPStorm will break at your breakpoint. (Of course you could execute that command many ways, but the point is you need to execute the version of drush that's vendored into the repo.
On earlier versions of drupal you can actually just put a copy of drush into your repo temporarily to solve the mapping problem in the same way.
Note that Matt Glaman also wrote a blog post on Xdebug Over the Command Line with DDEV
Also check PHPStorm and uncheck “Ignore external connections through unregistered server configurations."

Why is my netbeans not updating my html code

Today I installed netbeans on my home computer to do some work at home. I installed the java 8 JDK (151) and installed netbeans with everything included (didn't do a custom install). I then pulled my project down from github.
My install folder for netbeans is on E:\netbeans
My project folder is the default on c:
I loaded the project, turned on XAMPP and ran it. Great, it works.
Then I made a change to the HTML (fixes a spelling mistake I made). Ran it again. It didn't take the change.
I made sure I had saved - still borked
I made sure Firefox was not caching my page - still borked
I tried it in a different browser, one that had never opened the project before - borked
I rebooted netbeans - borked
I deleted the cache in netbeans -borked
I rebooted my computer - borked.
Google searches for "Netbeans not applying changes" or similar things are not returning me with anything useful (all of the same it is the browsers cache, I have caching turned off in Firefox using about:config and I turned of memory and cache)
Windows 10 system
Netbeans 8.2 up to date (there are no updates available)
Project is HTML,PHP to a XAMPP database.
Anyone have some advice on this?
Edit: as suggested I ran it in Admin mode. It still behaved the same.
I am running it through Netbeans but I then just navigated to the page without clicking run in netbeans and it is the same.
So I figured this out and will post it here in case anyone else looks into it.
I installed netbeans and xampp on my E drive. The project I was editing was on the C drive in xampp/htdocs. When I would save it would save there. I am unsure how this happened but on the E drive was another copy of the project. When I ran the project it would run from the folder E:\xampp\htdocs instead of where the project was in c:\xampp\htdocs. Keep in mind, when you install xampp is will make the C: folder regardless of where you say to install it.
Anyway, if you are having this problem and you have two hard drives look and make sure there is not a duplicate project in the two htdocs. If there is, you might be saving to one and running the other.
I was having this same problem. Try ignoring cached content when reloading the page. These commands should work on Chrome, Firefox, and Edge:
For PC:
Ctrl + Shift + R
For Mac:
Command + Shift + R
Source:
localhost Won't Immediately Update

Netbeans does not find all my include_once paths

I've just imported a largish php project into NetBeans. Under the top directory I have "app1", "app2", "app3", etc. (each of which are mapped to a domain name), then a "shared" directory for (you guessed it) files used by all the apps.
In app1/route/Search.inc it has:
include_once "../shared/lib/search.inc";
But ctrl-B on this line does nothing. Makes sense, from NetBeans point of view of this as one large application, it should be "../../shared/lib/search.inc". But, for the way the apps are configured, the above is correct, and NetBeans is wrong.
How do I tell NetBeans it needs to go one extra directory up?
Under Include Path, I tried adding "/full/path/to/app1" (so then "../shared/lib/" would be found) (I tried Private tab, then Shared tab, with same results.) But it rejects that, telling me the app1 directory is already part of the application. There is no "Do what I say, and don't think about it, slap!" button.
Adding symbolic links in the file system, just for NetBeans, feels a bit ugly.
I'm wondering if I should make one NetBeans project per app? (I actually tried that first, but as all apps are in the same git repository it gave a lot of noise, so I assumed that was the wrong way.)
ADDITIONAL: I'm most interested in the answer to my last question - is it standard practice to keep each app as a separate NetBeans project, even if they are all in the same git repository?
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 1
Java: 1.7.0_79; OpenJDK 64-Bit Server VM 24.79-b02
Runtime: OpenJDK Runtime Environment 1.7.0_79-b14
(on linux Mint 17)
Make shure that all files of your project are in the project's include path (righ click project -> properties -> include path). Usually there is only the "global include path", which you configure in the NetBeans settings (e.g. to point to your PEAR directory). Add all directories which contain source code you want auto completion for to this include path. Hint: This include path has nothing to do with the include_path used in PHP itself.
I'm wondering if I should make one NetBeans project per app? (I actually tried that first, but as all apps are in the same git repository it gave a lot of noise, so I assumed that was the wrong way.)
Yes you should have different NetBeans projects if your apps are separate, and since they are on different domains, it sounds like they are pretty distinct.
One way you can reduce the noise level of this approach is to right click the other app directories and find the option to Mark directory as > excluded and it should disappear (and the files won't be indexed for autocomplete / search / etc).
I have no problems with such a scenario, if I only select the filename. Then NetBeans search for a file with this name in the whole project directory.
If I select the filename and the path, it does not work. Maybe that is your problem?
I have changed nothing else and it works like a charm.
there is a alternative way to set path i.e. via php.ini
add the following line in php.ini set path of
include_path = ".:c:\xampp\htdocs\project_name\your_include_folder_name"
restart the apache server

Which PHP file to add to my Path using WampServer (Win7/64)

I've been reading up on TDD using PHP and i'm ready to install PHPUnit, however...
I'm on Win7/64 running WampServer
I'm reading all these PEAR/PHPUnit install nightmare stories which are making me very leery.
So I'm considering using Composer to install PHPUNit (to skip the whole PEAR thing, for now).
Either way, it seems that it's best to have PHP in the PATH, which is not the case for default wampserver setup I suppose (since it's NOT already in my PATH)
I'm a bit confused about exactly which php file I should be adding to the PATH, as my directory (C:\wamp\bin\php\php5.3.10) has the following files:
php.exe
php-win.exe
I was planning on using number 1.
Finally, are there any other caveats that I should be aware of.
I'm using NetBeans (and SublimeText2 for front end stuff) and WampServer 2.2
Thanks!
sleeper
I Solved it. I just add the directory (C:\wamp\bin\php\php5.3.10), not an individual file. See my comment.

Categories