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/
Related
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."
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 ?
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
i am trying to use my workspace C:\Program Files (x86)\Zend\Apache2\htdocs, as i need to in order to use my Zend Server, but i get the error "workspace in use"
i have:
deleted all other copies of eclipse that i used
looked for a .metadata folder but not found one in my current eclipse folder (brand new eclipse PDT with Zend)
any idea as to what the problem can be? and how to fix it :D
thanks!
Check your workspace directory for :
.metadata and delete it (can be
hidden in your explorer)
.version.ini , open it an delete
all entrys
I think deleting .metadata will cause you to lose your tracked projects. Im not positive though ( don't really want to test it haha). However if you go in that folder (WORKSPACE/.metadata/) and delete the .lock file it should allow you to open the workspace. Hope this helps!
Just offering two other solutions for anyone who faces the workspace issue and ends up on this page.
This is one solution
and the other solution is if you were working on eclipse by connecting to a server via ssh.
In this case, the ssh might time out and your eclipse process would still be active on the server.
Solution is:
Type ps -aef | grep eclip
Find the process number of eclipse and type kill -9 process number
I currently use Notepad++ for most of my development. I have been checking out other, more full-featured options and would like to switch (I'm in particular a fan of Aptana so far) but there is one thing about Notepad++ that I really like and I haven't been able to get so far.
My current workflow is something like this: Workflow (I tried to embed this image and it showed up in previews but not in the post, sorry)
Workflow http://evanalyze.com/images/workflow.jpg
The process is this:
Download file from web server
Make edits in NP++
Save (this automatically saves a local copy in my default directory, which is also the folder I have setup using Subversion with Tourtise SVN)
When I want to commit a change to SVN, go through the local folder that has an up to date copy
What I can't figure out how to do with Aptana is automatically store a local copy of a file I download from my server, edit and save back to the server. Is there some way to do this? If so, that would solve my problem immediately.
Other options would be a suggestion for a better way to manage the relationship between my server, my editor and my SVN repository. I know Aptana can access my SVN repository too. Is there an easy way to commit changes from within Aptana when I want to (which means I could take Tourtise out of the equation I guess)?
Any suggestions appreciated. Thanks.
I think you're doing things a bit strange.
You already have all your information in an SVN repository, so why not take advantage of that?
You keep a working copy on your computer for development and testing. Save and commit your changes to SVN. On your server, do an SVN export (or checkout, with appropriate server rules to block web access to the .svn folders), and you're sweet!
---------------------- ------------ ---------------
| Local Working Copy | <---> | SVN Repo | <---> | Live server |
---------------------- ------------ ---------------
This means you never have to worry about FTP, or have to figure out which files have been changed locally and hence need to be updated.
Not too sure but I found PhpEd better than Zend for this kind of stuff - especially easy save to FTP.
If you want free general purpose IDE (which supports many languages,as well as Php) - then you should give a try to PsPad www.pspad.com. It can handle ftp very well
If you going to do alot of Php programming - then you have several dedicated (but not free) Php IDEs. PhpEd, PhpEdit, Php Designer, WeBuilder - each one of them have their pros and cons , all of them support ftp .
Eclipse has a plugin called RSE allow you to work on remote sources thru ssh,ftp etc.
You can use PDT but I guess it may work on Aptana as well.
I'm using the Zend Studio For Eclipse which has both SVN and RSE built in.
I'm guessing it's the same in PDT (after installing the RSE plugin), you can either work directly in the RSE perspective or add a remove folder to your project (you can do this only after adding connections in the RSE)
BTW, I found the following link that can give you some more options for remote machine:
http://wiki.eclipse.org/index.php/TM_and_RSE_FAQ#Working_with_TM_.2F_RSE_as_a_User
I currently have Eclipse installed with the Aptana plug-in so I have access to all of the cool features of Aptana.
You can either install Subclipse or Subversive for Eclipse which would effectively take care of needing TortoiseSVN. See: http://subclipse.tigris.org/install.html
Additionally, you can choose between installing and configuring PDT for Eclipse or using the Aptana PHP plugin (I've used both and I don't find that I necessarily prefer one over the other).
Lastly, both Aptana and Eclipse provide ftp and sftp support:
http://www.aptana.com/plugins
http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-857.html
I found Beyond Compare of Scooter Software to be a great tool for such needs.
Beyond Compare is a very valuable file and directory differ and merger for Windows and Linux which also is able to have one of the directories as ftp-link.
Beyond Compare even has a special plugin for source control systems, which unfortunately does not interact with the server, but is able to understand conflicts, for example.