PHP.exe closing on exit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Leon

    PHP.exe closing on exit

    Is there any way to stop php.exe closing after it processes a PHP script? It
    doesn't seem to have the traditional options of an MS-DOS program. I am
    using Windows XP Pro and have associated .php files to open with
    C:\PHP\php.exe -q %1.

    Thanks in advance,

    David Leon
    davidleon@iprim us.com.au


  • clvrmnky

    #2
    Re: PHP.exe closing on exit

    David Leon wrote:
    [color=blue]
    > Is there any way to stop php.exe closing after it processes a PHP script? It
    > doesn't seem to have the traditional options of an MS-DOS program. I am
    > using Windows XP Pro and have associated .php files to open with
    > C:\PHP\php.exe -q %1.
    >[/color]
    I'm somewhat puzzled by your assertion that this is not "traditiona l"
    behaviour. It is typical behaviour for the language interpreter
    executable to exit once it has exhausted it's arguments. That is, once
    your script exits, the PHP shell that launched it has no purpose, so it
    exits, as well.

    This is no different that Perl, Python or any typical shell scripting
    language.

    In your case, the php.exe you are using is the CGI executable, which may
    have different semantics than the Win32 command-line PHP executable.
    The default location for this is C:\php\cli\php. exe.

    Even so, I'd expect a language interpreter to exit once I'm done with it
    (i.e., the script it is running ends, or I send a signal to an
    interactive session).

    Comment

    • Jochem Huhmann

      #3
      Re: PHP.exe closing on exit

      clvrmnky <clvrmnky-uunet@coldmail. com.invalid> writes:
      [color=blue]
      > Even so, I'd expect a language interpreter to exit once I'm done with it
      > (i.e., the script it is running ends, or I send a signal to an
      > interactive session).[/color]

      Only when this interpreter is not a shell. The Unix shell or the Tcl
      shell (tclsh) just run an interactive shell waiting for input. They exit
      only when you tell them to do so. Is there a PHP shell?

      (Just for clarification: There are lots of interpreted languages I'd
      prefer over PHP for non-web purposes, on top of them Tcl. You get a
      GUI-Toolkit with it, too.)


      Jochem

      --
      "A designer knows he has arrived at perfection not when there is no
      longer anything to add, but when there is no longer anything to take
      away." - Antoine de Saint-Exupery

      Comment

      • David Leon

        #4
        Re: PHP.exe closing on exit

        All I want to do is test PHP scripts on my Windows XP client machine. I
        downloaded that Windows Installer package from www.php.net. I installed to
        C:\PHP which was the default directory. I associated .php files in Windows
        to open with C:\PHP\php.exe -q %1. So, when I double click on a .php file,
        the window opens, displays the output and closes. There are no .pif files
        associated with php.exe like the older DOS programs. That's what I mean
        about traditional options; I can't disable 'close on exit', etc. And I don't
        know how to keep the command prompt open globally either when I double click
        on something. I can use php.exe by starting the command prompt first but
        this is an inconvenience because I have to type the location of the file
        every time. This thing is driving me crazy! Any suggestions?


        "clvrmnky" <clvrmnky-uunet@coldmail. com.invalid> wrote in message
        news:HI2Gb.1703 25$PD3.5876140@ nnrp1.uunet.ca. ..[color=blue]
        > David Leon wrote:
        >[color=green]
        > > Is there any way to stop php.exe closing after it processes a PHP[/color][/color]
        script? It[color=blue][color=green]
        > > doesn't seem to have the traditional options of an MS-DOS program. I am
        > > using Windows XP Pro and have associated .php files to open with
        > > C:\PHP\php.exe -q %1.
        > >[/color]
        > I'm somewhat puzzled by your assertion that this is not "traditiona l"
        > behaviour. It is typical behaviour for the language interpreter
        > executable to exit once it has exhausted it's arguments. That is, once
        > your script exits, the PHP shell that launched it has no purpose, so it
        > exits, as well.
        >
        > This is no different that Perl, Python or any typical shell scripting
        > language.
        >
        > In your case, the php.exe you are using is the CGI executable, which may
        > have different semantics than the Win32 command-line PHP executable.
        > The default location for this is C:\php\cli\php. exe.
        >
        > Even so, I'd expect a language interpreter to exit once I'm done with it
        > (i.e., the script it is running ends, or I send a signal to an
        > interactive session).
        >[/color]


        Comment

        • Tim Van Wassenhove

          #5
          Re: PHP.exe closing on exit

          On 2003-12-24, David Leon <davidleon@ipri mus.com.au> wrote:[color=blue]
          > All I want to do is test PHP scripts on my Windows XP client machine. I
          > downloaded that Windows Installer package from www.php.net. I installed to
          > C:\PHP which was the default directory. I associated .php files in Windows
          > to open with C:\PHP\php.exe -q %1. So, when I double click on a .php file,
          > the window opens, displays the output and closes. There are no .pif files
          > associated with php.exe like the older DOS programs. That's what I mean
          > about traditional options; I can't disable 'close on exit', etc. And I don't
          > know how to keep the command prompt open globally either when I double click
          > on something. I can use php.exe by starting the command prompt first but
          > this is an inconvenience because I have to type the location of the file
          > every time. This thing is driving me crazy! Any suggestions?[/color]

          start->programs->command(.exe ) or dosprompt or whatever that shell is
          called... c:\php\php.exe c:/path/to/script.php



          --
          verum ipsum factum

          Comment

          • clvrmnky

            #6
            Re: PHP.exe closing on exit

            Jochem Huhmann wrote:
            [color=blue]
            > clvrmnky <clvrmnky-uunet@coldmail. com.invalid> writes:
            >
            >[color=green]
            >>Even so, I'd expect a language interpreter to exit once I'm done with it
            >>(i.e., the script it is running ends, or I send a signal to an
            >>interactive session).[/color]
            >
            >
            > Only when this interpreter is not a shell. The Unix shell or the Tcl
            > shell (tclsh) just run an interactive shell waiting for input. They exit
            > only when you tell them to do so. Is there a PHP shell?
            >[/color]
            Clarification: they exit when they reach end-of-file, just like if they
            were invoked as a subshell to run a script.

            Most interpreters can be invoked as a "shell". When you login to any
            console and run a script from the login shell, that script (even if it
            is in the same "language" as the login shell) is run in a subshell.
            When you "exit" the login shell, you are logged out.

            Consider the classic behaviour of any UNIX login shell when you give it
            the End-of-file character (cntrl-d). It logs you out. This is not a
            mistake, as the shell is running until it runs out of standard in. This
            is the exact same behaviour as php.exe, python.exe, ksh.exe and perl.exe
            when you run them w/o any arguments.

            So, my assertion was that logging into any Windows shell (cmd.exe or
            whatever) and running "php -f somephpscript.p hp" (or whatever the
            particular syntax for php.exe is) starts a PHP subshell in the login
            shell which executes the lines in somephpscript.p hp. Once the lines in
            this file are exhausted, the subshell hits the EOF, and exits, dropping
            you back into the login shell interpretive loop.
            [color=blue]
            > (Just for clarification: There are lots of interpreted languages I'd
            > prefer over PHP for non-web purposes, on top of them Tcl. You get a
            > GUI-Toolkit with it, too.)
            >[/color]
            Of course. PHP was designed with a specific set of jobs in mind.
            Having an PHP interpreter at the command-line is just gravy, and is
            great for testing.

            Comment

            Working...