How do I ignore certain files while debugging in PHPStorm?

Asked
Active3 hr before
Viewed126 times

7 Answers

certainignorefiles
90%

Alternately, go to Settings | PHP | Debug in PHPStorm and add a directory to the debug ignore list.,Add it with the + sign in the skipped files section and navigate to the folder containing the file.,This sets custom PHP ini settings on the command line interface.,This way you can easily enable the debugger for one command line session using the following command:

One possible solution is to add the following parameters to the bat file that runs phpcs:

-d xdebug.remote_host = "8.8.1.1"\ -
   d xdebug.remote_enable = 0\ -
   d xdebug.remote_autostart = 0
load more v
88%

A more common practice is to use Xdebug te debug PHP code.,In PHP development environments, it is not entirely uncommon to use an auto_prepend_file to add development-specific functionality to an application. Usually such a file is used for several projects at the same time. This means the prepend file resides somewhere in a more high-level location.,But there is another solution that will work for files living outside of the project.,Force break at first line when a script is outside the project

load more v
72%

Pause Program – not available during debugging,Enter Xdebug, the rather awesome step debugging and profiling tool for PHP.,Inspect existing arrays, objects, and class instances to find the data available to me in code, so I can use it in new code I write,View Breakpoints – bring up a window of all the breakpoints set in all files of the project

A few years ago I didn’t know debuggers existed, had never heard of Xdebug, and was quite happy using a function I’d cobbled together pinched from Stack Overflow in all my WordPress sites for debugging:

if (!function_exists('_log')) {
   function _log($message) {
      if (WP_DEBUG === true) {
         if (is_array($message) || is_object($message)) {
            error_log(print_r($message, true));
         } else {
            error_log($message);
         }
      }
   }
}
load more v
65%

While typing isn’t connected directly to IDE skills, shortcuts are useless if you need to stare at your keyboard to find every single key.,If you need to search something found in multiple files, use the find in path search (Ctrl + Shift + F), and try to make search options (filtering) as specific as you can.,Ctrl+E will show you a list of recently used files, and if you immediately push Enter, you’ll be switched to the file used just before the current one.,Next, let’s exclude searching in comments and string literals, and limit our results by .php files only.

load more v
75%

Disable xdebug for better performance when not debugging with ddev xdebug off,Use ddev xdebug on to enable xdebug when you want it, and ddev xdebug off when you're done with it.,Enable XDebug with ddev xdebug on,Enable xdebug by running ddev xdebug or ddev xdebug on in your project directory. It will remain enabled until you start or restart the project.

  "atom-ide-ui":
  "atom-ide-debugger": {}
  use:
     "atom-ide-debugger": "never"
  "php-debug":
  PathMaps: [
     "remotepath;localpath"
     "/var/www/html;/Users/rfay/workspace/d8git"
  ]
load more v
40%

There are several logging levels which can be configured through xdebug.log_level.,The log file will contain to which IP addresses it is attempting to connect and at which ports, which should be a great help debugging why it sometimes doesn't work. A "remote log file" is also required when reporting a bug in Xdebug's step debugger.,Configures which logging messages should be added to the log file.,This setting controls which Xdebug features are enabled.

The log file will include any attempt that Xdebug makes to connect to an IDE:

[2693358] Log opened at 2020 - 09 - 02 07: 19: 09.616195[2693358][Step Debug] INFO: Connecting to configured address / port: localhost: 9003.[2693358][Step Debug] ERR: Could not connect to debugging client.Tried: localhost: 9003(through xdebug.client_host / xdebug.client_port): -(
      [2693358][Profiler] ERR: File '/foo/cachegrind.out.2693358'
      could not be opened.
      [2693358][Profiler] WARN: /foo: No such file or directory [2693358][Tracing] ERR: File '/foo/trace.1485761369'
      could not be opened.
      [2693358][Tracing] WARN: /foo: No such file or directory [2693358] Log closed at 2020 - 09 - 02 07: 19: 09.617510
INFO: Connecting to configured address / port: localhost: 9003.
ERR: Could not connect to debugging client.Tried: localhost: 9003(through xdebug.client_host / xdebug.client_port): -(
ERR: File '/foo/cachegrind.out.2693358'
could not be opened.
WARN: /foo: No such file or directory
ERR: File '/foo/trace.1485761369'
could not be opened.
WARN: /foo: No such file or directory

The debugging log can also log the communication between Xdebug and an IDE. This communication is in XML, and starts with the <init XML element:

<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/httpd/www.xdebug.org/html/router.php" language="PHP" xdebug:language_version="7.4.11-dev" protocol_version="1.0" appid="2693358" idekey="XDEBUG_ECLIPSE">
   <engine version="3.0.0-dev">
      <![CDATA[Xdebug]]>
   </engine>
   <author>
      <![CDATA[Derick Rethans]]>
   </author>
   <url>
      <![CDATA[https://xdebug.org]]>
   </url>
   <copyright>
      <![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]>
   </copyright>
</init>

Beyond the <init element, you will find the configuration of features:

<- feature_set -i 4 -n extended_properties -v 1 ->
   <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1">
   </response>
<- step_into -i 9 ->
   <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="9" status="break" reason="ok">
      <xdebug:message filename="file:///home/httpd/www.xdebug.org/html/router.php" lineno="3">
      </xdebug:message>
   </response>

Many Linux distributions now use systemd, which implements private tmp directories. This means that when PHP is run through a web server or as PHP-FPM, the /tmp directory is prefixed with something akin to:

/tmp/systemd - private - ea3cfa882b4e478993e1994033fc5feb - apache.service - FfWZRg
load more v
22%

PhpStorm provides you with a variant of automatic code completions. First, PhpStorm needs to index all files inside your Project. This might take a while, depending on the number and size of files in your project.,To exclude directories from indexing, open the Settings and select Directories in the left sidebar. You can now select directories on the right side and mark them as excluded by clicking on Excluded above.,From the context menu Mark directory as -> Excluded,In the settings tree choose Editor | Code Style | PHP

Requirements for developing

First of all you need a working Shopware installation. Just visit our Github Repository and follow the README.md installation instructions. You do not want to worry about a local webserver or database server? Then take a look at our Vagrant and PHPStorm guide to set up a virtual machine, ready to develop with Shopware. If you want to contribute to the Shopware repository also check out our contribution guideline.

README.md
load more v

Other "certain-ignore" queries related to "How do I ignore certain files while debugging in PHPStorm?"