FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-16-2012, 11:29 PM
Alan Chandler
 
Default How do you debug with php

I have just had a frustrating few days trying, and failing to set up a
debugging session with a php based web app.


My setup is a yii based application, but with the framework sitting in a
separate directory since (supposidely) the only file you actually have
to expose to the web space is the index.php as the base url.


So my document root is at ~/dev/football/app and the framework is at
~/dev/yii/framework


I would like to put a breakpoint on the index.php in document root and
single step tracking its progress through the entire sequence.


I have tried with multiple versions of eclipse with the PDT tools and
xdebug. But whatever I do I end never hitting any breakpoints
(including the fact that it says break before the first line).


I have tried with kdevelop and the kdevelop-php plugin. I got it
running once, but now It crashes before it even loads.


I have tried with phpstorm, but it seems to need the entire php code
within the web space, and doesn't allow for document root somewhere
inside the directory hierarchy (at least i can't find a way to set it up).


debian doesn't seem to support the potential addings to vim and emacs.

What do others use?


--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4F8CAB55.5060605@chandlerfamily.org.uk">http://lists.debian.org/4F8CAB55.5060605@chandlerfamily.org.uk
 
Old 04-17-2012, 12:16 AM
Chris Hiestand
 
Default How do you debug with php

I have never used a debugger for PHP; I think your struggles are part of the reason why.

Instead I just use debug statements when I hit a problem - probably not quite as clean as using a debugger.

Something like this helps me a lot:


> function pre_print_r($a) {
> print "
<pre>
";
> print_r($a);
> print "
</pre>
";
> }

https://github.com/dimmer/impphp/blob/master/Utilities.php


Well, that, and setup error and exception handlers which output a backtrace. Using these tools I've gotten
by without a debugger on large projects.

-Chris



On Apr 16, 2012, at 4:29 PM, Alan Chandler wrote:

> I have just had a frustrating few days trying, and failing to set up a debugging session with a php based web app.
>
> My setup is a yii based application, but with the framework sitting in a separate directory since (supposidely) the only file you actually have to expose to the web space is the index.php as the base url.
>
> So my document root is at ~/dev/football/app and the framework is at ~/dev/yii/framework
>
> I would like to put a breakpoint on the index.php in document root and single step tracking its progress through the entire sequence.
>
> I have tried with multiple versions of eclipse with the PDT tools and xdebug. But whatever I do I end never hitting any breakpoints (including the fact that it says break before the first line).
>
> I have tried with kdevelop and the kdevelop-php plugin. I got it running once, but now It crashes before it even loads.
>
> I have tried with phpstorm, but it seems to need the entire php code within the web space, and doesn't allow for document root somewhere inside the directory hierarchy (at least i can't find a way to set it up).
>
> debian doesn't seem to support the potential addings to vim and emacs.
>
> What do others use?
>
>
> --
> Alan Chandler
> http://www.chandlerfamily.org.uk
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/4F8CAB55.5060605@chandlerfamily.org.uk
>
 
Old 04-17-2012, 06:01 AM
Alan Chandler
 
Default How do you debug with php

On 17/04/12 01:16, Chris Hiestand wrote:

I have never used a debugger for PHP; I think your struggles are part of the reason why.

Neither have I until now.

But I don't understand why this isn't a typical many eyes make the
problems trivial, and that there isn't a great raft of solutions out
there that just work.


I am particular puzzled with Eclipse. The PDT project has been going
for a long while now and yet there is question after question on the
forum as to why xdebug fails to catch their breakpoints. I have it set
to break on the first line of the file I am debugging, yet it still
doesn't seem to work. This leaves me to believe that I am doing
something wrong, but I just don't know what.


--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4F8D0756.5090200@chandlerfamily.org.uk">http://lists.debian.org/4F8D0756.5090200@chandlerfamily.org.uk
 
Old 04-17-2012, 06:42 AM
Alan Chandler
 
Default How do you debug with php

On 17/04/12 07:01, Alan Chandler wrote:

On 17/04/12 01:16, Chris Hiestand wrote:
I have never used a debugger for PHP; I think your struggles are part
of the reason why.

Neither have I until now.

But I don't understand why this isn't a typical many eyes make the
problems trivial, and that there isn't a great raft of solutions out
there that just work.


I am particular puzzled with Eclipse. The PDT project has been going
for a long while now and yet there is question after question on the
forum as to why xdebug fails to catch their breakpoints. I have it
set to break on the first line of the file I am debugging, yet it
still doesn't seem to work. This leaves me to believe that I am doing
something wrong, but I just don't know what.



Funny how things happen

JUST after I sent this email I tried a new approach.

I blew away the entire Eclipse configuration, and reloaded the base
Eclipse, and then started it up. Instead of defining a workspace within
my current development environment I defined a separate workspace. I
then updated Eclipse within itself with the PDT SDK.


I created a new project and told it to link to the existing files which
it just did.


I then setup my debugging environment and it immediately broke on the
first line of the file when I ran it. I then, by accident, found it
crashed if I had the variables tab open, and from then on its working
perfectly EXCEPT if I select the Variables tab (the one that shows the
values of all the variables) it crashes.



--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4F8D10D3.6000205@chandlerfamily.org.uk">http://lists.debian.org/4F8D10D3.6000205@chandlerfamily.org.uk
 

Thread Tools




All times are GMT. The time now is 06:09 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org