By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,458 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,458 IT Pros & Developers. It's quick & easy.

Newbie: Any command line or non-browser debugging tool for php?

P: n/a
Browser has its own settings, java, javascripts, addons, extensions,
keyboard shortcuts, along with the problem in html coding in the php
file, which all I think might interfere with seeing only the php part.

Is there any interface where I can test/ debug my php code snippets
without browser? Any xpsp3/ dos command line or other utility that would
at process my php file and least allow me to see the output (final html
that would go to the browser) on the screen and allow me to redirect it
to some disk file?

There are shells for JavaScripts. Any equivalent Php shell?

Seems I still find good old bare dos more friendly than the
paraphernelia of windows.

Thanks.
--
V
Aug 11 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 11 Aug, 09:01, V S Rawat <vsra...@gmail.comwrote:
Browser has its own settings, java, javascripts, addons, extensions,
keyboard shortcuts, along with the problem in html coding in the php
file, which all I think might interfere with seeing only the php part.

Is there any interface where I can test/ debug my php code snippets
without browser? Any xpsp3/ dos command line or other utility that would
at process my php file and least allow me to see the output (final html
that would go to the browser) on the screen and allow me to redirect it
to some disk file?

There are shells for JavaScripts. Any equivalent Php shell?

Seems I still find good old bare dos more friendly than the
paraphernelia of windows.

Thanks.
--
V
Most php debugging tools do not use a browser. XDEBUG is pretty good.
However, regardless of browser settings, you can always see the actual
server output. So I think you are trying to solve a non-existent
problem.
Aug 11 '08 #2

P: n/a

V S Rawat schreef:
Browser has its own settings, java, javascripts, addons, extensions,
keyboard shortcuts, along with the problem in html coding in the php
file, which all I think might interfere with seeing only the php part.

Is there any interface where I can test/ debug my php code snippets
without browser? Any xpsp3/ dos command line or other utility that would
at process my php file and least allow me to see the output (final html
that would go to the browser) on the screen and allow me to redirect it
to some disk file?

There are shells for JavaScripts. Any equivalent Php shell?

Seems I still find good old bare dos more friendly than the
paraphernelia of windows.

Thanks.
Hi,

I do not know of a commandline debugging utility, but you can of course
call any script from commandline by simply invoking PHP.
You will NOT have $_POST and the like filled of course if you use
commandline invocation of PHP.

To be honest, I seriously doubt you need such a debugger..
Just use your PHP output smart, add the information you want to the
output, and you can debug about anything in a browser.

A few pointers to get the work done:
1) Make sure that PHP gives all errors/warnings/notices back by enabling
this (error_reporting in php.ini or use ini_set()).

2) If you are in doubt of the output, simply use 'view source' in the
browser.

3) If you want to see a few variable, simply output them to the browser,
possibly you will need htmlspecialchars() function if the content of the
variables have a meaning in html, like <>.
eg:
echo "\$someSuspectVar=".htmlspecialchars($someSuspectV ar,ENT_QUOTES);

4) If you want to inspect some array, use this:
echo "<pre>";
print_r($myArray);
echo "</pre>";
That will output it in a clear way to your browser.

I have been programming PHP for many years and never used anything else
that the output of php to the browser. And I never touched a debugger in
PHP. Most PHP developers I know do it like that.

Since commanline use of PHP is not very useful when developing an
webapplication (because of the missing $_POST/$_GET/$_COOKIE and missing
sessions), it is best to develop right away for the real situation.

just my 2 cent...

Regards,
Erwin Moller

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
Aug 11 '08 #3

P: n/a
NC
On Aug 11, 1:01 am, V S Rawat <vsra...@gmail.comwrote:
>
There are shells for JavaScripts. Any equivalent Php shell?
Yes and no... PHP ships with a command-line interpreter, which you
can use with -l option to check for syntax errors. You can also catch
some runtime errors with it if you run your scripts from command line
("some", because you won't be able to imitate request variables,
session variables, and cookies with a command-line interpreter).

Cheers,
NC
Aug 12 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.