[xdebug-general] Re: xdebug

From: Spencer Williams IV <enderandpeter[@]yahoo.com>
Date: Mon, 19 Mar 2018 13:52:17 -0600

On 3/19/18 12:13 PM, Richard Dunne wrote:
> Breakpoints are in php code. (As opposed to html)
>
> The dialog is available only when the PHP plugin is enabled.  Not very
> specific.
> The following php plugins are enabled.
> PHP Docker
> PHP RemoteInterpreter
> PhPSpec BDD Framework.
> PhpStorm Workshop
>
> Am I missing one?
>
>
> On Mon, 19 Mar 2018 at 17:49 Richard Dunne <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>> wrote:
>
> Yes and yes.
>
> On Mon, 19 Mar 2018 at 17:43 Marco "Debo" De Bortoli
> <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>> wrote:
>
> Did you activate listen mode? Did you add a breakpoint on the
> line where you want the debugger to stop?
>
> On 19 March 2018 at 17:42, Richard Dunne
> <richarddunnebsc[@]gmail.com <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> I've started a debug session in the browser, reloaded the
> page, Switch to PhpStorm; you'll see the *Incoming
> Connection From Xdebug* dialogue. That didn't happen.
>
> On Mon, 19 Mar 2018 at 16:46 Marco "Debo" De Bortoli
> <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>> wrote:
>
> I use neither. As I explained to you, you have to use
> the xdebug helper of your browser and put PhpStorm in
> listening mode. Look at this zero configuration blog
> post from JetBrains
>
> https://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
>
> Please let me know if that works.
>
> Debo
>
> On 19 March 2018 at 16:12, Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>> wrote:
>
> I'm currently using PhpStorm.  I want to debug
> code after submitting a form.  There are three
> options, Run, Debug and Run with Coverage.  Which
> is the correct option to use?
>
> On Mon, 19 Mar 2018 at 16:02 Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>> wrote:
>
> After adding zend_extension =
> c:\wamp64\bin\php\php7.1.9\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll
>
> to
> C:\wamp64\bin\apache\apache2.4.27\bin\php.ini
> xdebug now appears in phpinfo.
>
> On Mon, 19 Mar 2018 at 14:51 Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>> wrote:
>
> The odd thing is it was in phpinfo when I
> was using VSC.  I've been trying PhpStorm
> today. According to the install instructions
> |zend_extension=<full_path_to_xdebug_extension>|
> |xdebug.remote_enable=||1|
> |xdebug.remote_host=<the host where
> PhpStorm is running (e.g. localhost)>|
> |xdebug.remote_port=<the port to which
> Xdebug tries to connect on the host where
> PhpStorm is running (||default| |9000||)>|
> |
> |
> |
> zend_extension =
> "c:\wamp64\bin\php\php7.1.9\ext\php_xdebug-2.6.0-7.2-vc15-x86_64.dll"
> xdebug.remote_enable = 1
> xdebug.remote_host=localhost
> xdebug.remote_port=9000
>
> C:\wamp64\bin\php\php7.1.9>php -v
> PHP 7.1.9 (cli) (built: Aug 30 2017
> 18:34:46) ( ZTS MSVC14 (Visual C++ 2015) x64 )
> Copyright (c) 1997-2017 The PHP Group
> Zend Engine v3.1.0, Copyright (c)
> 1998-2017 Zend Technologies
>
>
> |
>
> On Mon, 19 Mar 2018 at 14:37 Marco "Debo"
> De Bortoli <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>>
> wrote:
>
> But that would explain why the
> debugging is not working... if xdebug
> doesn't appear it means it's not loaded.
>
> On 19 March 2018 at 14:03, Richard
> Dunne <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>> wrote:
>
> These are the settings in the .ini
>
> zend_extension =
> "c:\wamp64\bin\php\php7.1.9\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
>
> xdebug.remote_enable = 1
> xdebug.remote_autostart = 0
> xdebug.remote_log =
> "c:/wamp64/php/php7.1.9/xdebug.log"
> xdebug.remote_connect_back=0
> xdebug.remote_host=127.0.0.1
> xdebug.remote_port=9000
> xdebug.profiler_enable = off
> xdebug.profiler_enable_trigger = Off
> xdebug.profiler_output_name =
> cachegrind.out.%t.%p
> xdebug.profiler_output_dir
> ="c:/wamp64/tmp"
> xdebug.show_local_vars=0
>
> I restarted wampserver, I just
> noticed that xdebug does not
> appear in phpinfo. That's not helpful.
>
> On Mon, 19 Mar 2018 at 12:27 Marco
> "Debo" De Bortoli
> <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>>
> wrote:
>
> Did you also do the other
> things I mentioned?
>
> On 19 March 2018 at 12:19,
> Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> Yes, XDebug is installed
> and loaded.
>
> On Mon, 19 Mar 2018 at
> 12:11 Marco "Debo" De
> Bortoli
> <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>>
> wrote:
>
> Hi Richard,
>
> sorry my bad, I should
> have specified that
> I'm using OSX hence
> the .so instead of the
> .dll.
> What about the remote
> host address, although
> it shouldn't be needed
> with phpstorm in
> listening mode?Did you
> verified that xdebug
> is loaded?
>
> On 19 March 2018 at
> 12:07, Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> zend_extension=/usr/lib64/php/5.6/modules/xdebug.so
>
> The ini file only
> uses .dll or so I
> thought. In any
> case, I don't have
> xdebug.so in the
> ini if that's
> where its supposed
> to be.
>
> On Mon, 19 Mar
> 2018 at 11:19
> Marco "Debo" De
> Bortoli
> <marco.debo.debortoli[@]gmail.com
> <mailto:marco.debo.debortoli[@]gmail.com>>
> wrote:
>
> Hi Richard,
>
> I'm not sure
> why is not
> working for
> you but I can
> notice few
> differences in
> you .ini
> configuration
> compared to
> the one I
> usually use
> myself. You
> can find it
> here
> <https://gist.github.com/debo/b6d212cdb759269de929>.
>
> Also,
> apologies if
> I'm asking
> something that
> you already
> mentioned but,
> did you ensure
> that the
> xdebug is
> actually
> loaded and active?
>
> In terms of
> how to debug,
> I usually use
> PhpStorm, I do
> activate the
> listening mode
> which the
> telephone
> shaped icon,
> then activate
> the xdebug
> helper in the
> browser in the
> page I want to
> debug and then
> start
> interacting
> with the page
> itself; also
> don't forget
> to add
> breakpoints or
> the debugger
> won't stop
> unless you
> tell it to
> stop on the
> first line.
>
> I hope it helps.
>
> Debo
>
> On 19 March
> 2018 at 11:08,
> Richard Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> I
> installed
> PhpStorm
> for
> comparison.
> PhpStorm
> opens the
> current
> script in
> a web
> browser
> for user
> input. 
> VSC
> doesn't do
> that.  I'm
> still
> trying to
> figure out
> why XDebug
> isn't
> engaging
> when the
> form is
> submitted
> in Listen
> for XDebug
> config and
> XDebug
> Helper is
> engaged
> and in
> debug mode.
> These are
> the
> settings I
> have
>
> launch.json
> "version":
> "0.2.0",
> "configurations":
> [
>         {
>   "name":
> "Listen
> for XDebug",
>   "type":
> "php",
>  
> "request":
> "launch",
>   "port": 9000
> },
>         {
>   "name":
> "Launch
> currently
> open script",
>   "type":
> "php",
>  
> "request":
> "launch",
>  
> "program":
> "${file}",
>   "cwd":
> "${fileDirname}",
>   "port": 9000
>         }
>     ]
>
> settings.json
> user settings
> "php.validate.executablePath":
> "C:/wamp64/bin/php/php7.1.9/php.exe",
> "php.executablePath":
> "C:/wamp64/bin/php/php7.1.9/php.exe",
> "workbench.startupEditor":
> "newUntitledFile",
> "files.autoSave":
> "onWindowChange",
> "workbench.editor.enablePreview":
> false,
> "git.ignoreMissingGitWarning":
> true
>
> phpForApache.ini
>
> [xdebug]
> zend_extension
> =
> "c:\wamp64\bin\php\php7.1.9\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
>
> xdebug.remote_enable
> = On
> xdebug.remote_autostart
> = 1
> xdebug.remote_log
> =
> "c:/wamp64/php/php7.1.9/xdebug.log"
> xdebug.profiler_enable
> = off
> xdebug.profiler_enable_trigger
> = Off
> xdebug.profiler_output_name
> =
> cachegrind.out.%t.%p
> xdebug.profiler_output_dir
> ="c:/wamp64/tmp"
> xdebug.show_local_vars=0
>
> Is there
> anything
> missing?
>
> On Sun, 18
> Mar 2018
> at 21:06
> Richard
> Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> I
> changed
> the
> log
> location
> to
> include
> the
> filename,
> but
> still
> no
> joy,
> log
> not
> created. 
> Th
> documentation
> on
> XDebug
> is
> very
> limited
>
>
> On
> Sun,
> 18 Mar
> 2018
> at
> 19:57
> Spencer
> Williams
> IV
> <enderandpeter[@]yahoo.com
> <mailto:enderandpeter[@]yahoo.com>>
> wrote:
>
> On
> Sunday,
> March
> 18,
> 2018,
> 1:31:50
> PM
> MDT,
> Richard
> Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
>
>
> I
> have
> set
> a
> path
> for
> xdebug.remote_log,
>
> xdebug.remote_log
> =
> "c:/wamp64/php/php7.1.9"
> I
> started
> XDebug
> in
> Visual
> Studio
> Code
> with
> Listen
> for
> XDebug
> config,
> then
> I
> enabled
> debugging
> in
> the
> browser(XDebug
> Helper),
> then
> selected
> Debug.
>
> Submitted
> the
> form
> with
> the
> hope
> that
> XDebug
> would
> do
> its
> thing.
> The
> code
> executed,
> but
> the
> debugger
> didn't
> do
> anything,
> such
> as
> create
> a log.
>
> On
> Sun,
> 18
> Mar
> 2018
> at
> 16:52
> Spencer
> Williams
> IV
> <enderandpeter[@]yahoo.com
> <mailto:enderandpeter[@]yahoo.com>>
> wrote:
>
> On
> Sunday,
> March
> 18,
> 2018,
> 9:38:46
> AM
> MDT,
> Richard
> Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
>
>
> I'm
> familiar
> with
> code
> breakpoints,
> not
> the
> form
> handler. 
> Is
> there
> any
> documentation
> on
> that?
>
>
>
> On
> Sun,
> 18
> Mar
> 2018
> at
> 07:58
> Tim
> Hawkins
> <tim.thawkins[@]gmail.com
> <mailto:tim.thawkins[@]gmail.com>>
> wrote:
>
> You
> need
> to
> set
> a
> breakpoint
> on
> your
> form
> handler
> with
> your
> ide.
>
> On
> Sun,
> Mar
> 18,
> 2018,
> 10:52
> Richard
> Dunne
> <richarddunnebsc[@]gmail.com
> <mailto:richarddunnebsc[@]gmail.com>>
> wrote:
>
> These
> are
> the
> ini
> settings
>
> zend_extension
> =
> "c:\wamp64\bin\php\php7.1.9\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
> xdebug.remote_enable
> =
> On
> xdebug.remote_autostart
> =
> 1
> xdebug.remote_log
> =
> "c:/wamp64/php/php7.1.9"
> xdebug.profiler_enable
> =
> off
> xdebug.profiler_enable_trigger
> =
> Off
> xdebug.profiler_output_name
> =
> cachegrind.out.%t.%p
> xdebug.profiler_output_dir
> ="c:/wamp64/tmp"
> xdebug.show_local_vars=0
> "There
> are
> handful
> of
> nice
> browser
> plugins
> out
> there
> where
> you
> can
> enable
> the
> sending
> of
> the
> appropriate
> data
> to
> trigger
> the
> Xdebug
> session"
> This
> is
> new
> information.
> I
> thought
> once
> the
> debugger
> was
> set
> to
> Listen
> for
> Xdebug,
> that's
> all
> that
> was
> required. 
> I
> added
> XDebug
> Helper
> to
> Chrome. 
> Does
> it
> required
> any
> config
> within
> Visual
> Studio
> Code
> or
> php.ini? 
> Does
> XDebug
> Helper
> engage
> XDebug
> when
> a
> form
> is
> submitted?
>
>
>
>
> On
> Sat,
> 17
> Mar
> 2018
> at
> 21:49
> Spencer
> Williams
> <enderandpeter[@]yahoo.com
> <mailto:enderandpeter[@]yahoo.com>>
> wrote:
>
> On
> 3/16/2018
> 12:34
> PM,
> Richard
> Dunne
> wrote:
>> How
>> do
>> I
>> get
>> XDebug
>> to
>> start
>> debugging
>> when
>> I
>> submit
>> a
>> form?. 
>> I
>> start
>> the
>> debugger,
>> Step
>> buttons
>> are
>> inactive
>> and
>> nothing
>> happens
>> when
>> I
>> submit
>> a
>> form. 
>> Are
>> there
>> any
>> tutorials
>> for
>> this?
>>
>> --
>>
>> Sincerely,
>>
>>
>> Richard
>> Dunne
>> B.Sc.
>
> Did
> you
> get
> it
> working?
> What
> xdebug
> INI
> settings
> have
> you
> set?
> Make
> sure
> to
> at
> least
> enable
> xdebug.remote_enable.
> Is
> the
> web
> server
> running
> directly
> on
> the
> host
> machine?
> Or
> in
> a
> VM
> of
> some
> kind?
> If
> the
> latter
> is
> the
> case,
> then
> you'll
> want
> to
> make
> sure
> xdebug.remote_host
> is
> set
> appropriately,
> as
> xdebug.remote_connect_back
> might
> not
> get
> the
> appropriate
> hostname/IP
> automatically.
>
> Also,
> you
> can
> either
> set
> xdebug.remote_autostart
> or
> make
> sure
> you
> set
> a
> request
> variable
> or
> cookie
> of
> the
> expected
> name
> and
> value
> <https://xdebug.org/docs/remote#browser_session>
> when
> submitting
> the
> form.
> There
> are
> handful
> of
> nice
> browser
> plugins
> out
> there
> where
> you
> can
> enable
> the
> sending
> of
> the
> appropriate
> data
> to
> trigger
> the
> Xdebug
> session.
> And
> make
> sure
> your
> IDE
> is
> listening
> for
> Xdebug
> responses,
> of
> course.
> If
> anything,
> you
> can
> set
> xdebug.remote_log
> to
> try
> to
> get
> a
> better
> idea
> of
> what
> might
> be
> going
> on.
>
> Let
> us
> know
> how
> things
> progress...
>
>
> --Spencer
>
> --
>
> Sincerely,
>
>
> Richard
> Dunne
> B.Sc.
>
> --
>
> Sincerely,
>
>
> Richard
> Dunne
> B.Sc.
>
>
> Yes,
> if
> you
> set
> xdebug.remote_autostart
> you
> won't
> have
> to
> send
> the
> request
> data.
> Try
> setting
> xdebug.remote_log
> to
> a
> path
> where
> it
> can
> create
> a
> log
> file.
> Let
> us
> know
> what
> it
> says
> when
> you
> make
> a
> request
> to
> the
> server.
> Also
> what
> IDE
> are
> you
> using?
>
> --Spencer
>
> --
> Sincerely,
>
>
> Richard
> Dunne
> B.Sc.
>
>
> Make
> sure
> to
> set
> xdebug.remote_log
> to
> a
> file
> path
> rather
> than
> to
> a
> directory.
> So
> try
> c:/wamp64/php/php7.1.9/xdebug.log.
> Sadly
> I
> haven't
> worked
> with
> Xdebug
> in
> Visual
> Studio
> Code
> yet.
> Hopefully
> there
> are
> some
> guides
> online
> that
> will
> help
> as
> well.
>
> --Spencer
>
> --
> Sincerely,
>
>
> Richard
> Dunne
> B.Sc.
>
> --
> Sincerely,
>
> Richard
> Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.
>
> --
> Sincerely,
>
> Richard Dunne B.Sc.

Ah, it looks like you are getting closer. Damn, I should have first
asked about checking that Xdebug was actually enabled! I'm glad you have
confirmed that it certainly is. Also, do a php -i | grep xdebug or do
phpinfo() in a browser or something to confirm that it is really picking
up on the Xdebug INI settings you have set.

Okay, if you are using PHPStorm you will definitely want to go to the
top menu bar and select *Run -> Web Server Debug Validation*. This nifty
tool will tell you /exactly/ what is out of sorts as far as the IDE can
tell.

Also, go to *File -> Settings -> Languages & Frameworks -> PHP ->
Servers* and make sure you have a server configuration for this project.
However, it will probably pick up on a lot automatically since the web
server is so local.

-- 
--Spencer
Received on Mon Mar 19 2018 - 19:52:32 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST