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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • V S Rawat

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

    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
  • Captain Paralytic

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

    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.

    Comment

    • Erwin Moller

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


      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_reportin g 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 htmlspecialchar s() function if the content of the
      variables have a meaning in html, like <>.
      eg:
      echo "\$someSuspectV ar=".htmlspecia lchars($someSus pectVar,ENT_QUO TES);

      4) If you want to inspect some array, use this:
      echo "<pre>";
      print_r($myArra y);
      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/
      =============== =============

      Comment

      • NC

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

        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

        Comment

        Working...