p-s-e-x-e-c - PHP

This is a discussion on p-s-e-x-e-c - PHP ; Hi. I'm wanting to run an executable that generates a text file, and I'm having some issues. When I run the command on the server itself, it works just fine. When I run the same command via a webpage, the ...

+ Reply to Thread
Results 1 to 7 of 7

p-s-e-x-e-c

  1. Default p-s-e-x-e-c

    Hi. I'm wanting to run an executable that generates a text file, and I'm
    having some issues. When I run the command on the server itself, it works
    just fine. When I run the same command via a webpage, the text file does not
    generate. My first impression was that the permissions were wrong. So, I
    gave the web user and the user making the call the necessary permissions...
    no luck. Here's what I'm doing...

    <?php
    $command = "psexec.exe -i -w C:/Folder -u user -p pass -e
    C:/Folder/executable.exe 2>&1";
    exec ($command);
    ?>

    This should generate this file but doesn't: C:/Folder/printer_list.txt

    Again, when this exact statement is run in the terminal on the Win2k3
    server, it works fine. Any thoughts?

    Thanks in advance,
    ~Philip

    PS... Side note: the list rejected my original email b/c of the subject:
    'Psexec'. Odd.


  2. Default RE: [PHP] p-s-e-x-e-c


    > Hi. I'm wanting to run an executable that generates a text file, and I'm
    > having some issues. When I run the command on the server itself, it works
    > just fine. When I run the same command via a webpage, the text file does not
    > generate. My first impression was that the permissions were wrong. So, I
    > gave the web user and the user making the call the necessary permissions....
    > no luck. Here's what I'm doing...
    >
    > $command = "psexec.exe -i -w C:/Folder -u user -p pass -e
    > C:/Folder/executable.exe 2>&1";
    > exec ($command);
    > ?>
    >
    > This should generate this file but doesn't: C:/Folder/printer_list.txt
    >
    > Again, when this exact statement is run in the terminal on the Win2k3
    > server, it works fine. Any thoughts?
    >
    > Thanks in advance,
    > ~Philip
    >
    > PS... Side note: the list rejected my original email b/c of the subject:
    > 'Psexec'. Odd.


    Maybe you need the full path to psexec.exe

    Or the web server isn't allowed to use exec due to safemode http://php.he.net/manual/en/features....functions.php
    or disable_functions in php.ini.
    _________________________________________________________________
    Peek-a-boo FREE Tricks & Treats for You!
    http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us

  3. Default Re: [PHP] p-s-e-x-e-c

    On 10/18/07, Instruct ICC <instructicc@hotmail.com> wrote:
    >
    >
    > > Hi. I'm wanting to run an executable that generates a text file, and I'm
    > > having some issues. When I run the command on the server itself, it

    > works
    > > just fine. When I run the same command via a webpage, the text file does

    > not
    > > generate. My first impression was that the permissions were wrong. So, I
    > > gave the web user and the user making the call the necessary

    > permissions...
    > > no luck. Here's what I'm doing...
    > >
    > > $command = "psexec.exe -i -w C:/Folder -u user -p pass -e
    > > C:/Folder/executable.exe 2>&1";
    > > exec ($command);
    > > ?>
    > >
    > > This should generate this file but doesn't: C:/Folder/printer_list.txt
    > >
    > > Again, when this exact statement is run in the terminal on the Win2k3
    > > server, it works fine. Any thoughts?
    > >
    > > Thanks in advance,
    > > ~Philip
    > >
    > > PS... Side note: the list rejected my original email b/c of the subject:
    > > 'Psexec'. Odd.

    >
    > Maybe you need the full path to psexec.exe
    >
    > Or the web server isn't allowed to use exec due to safemode
    > http://php.he.net/manual/en/features....functions.php
    > or disable_functions in php.ini.



    Those are good suggestions. Unfortunately, I did try the full path to
    psexec.exe, safe_mode is NOT enabled and there are no functions listed as
    disabled.

    I have Google'd, but haven't been successful finding a solution. Anything
    else? =/

    Thanks,
    ~Philip


  4. Default Re: [PHP] p-s-e-x-e-c

    On 10/18/07, Philip Thompson <philthathril@gmail.com> wrote:
    >
    > On 10/18/07, Instruct ICC <instructicc@hotmail.com> wrote:
    > >
    > >
    > > > Hi. I'm wanting to run an executable that generates a text file, and

    > I'm
    > > > having some issues. When I run the command on the server itself, it

    > > works
    > > > just fine. When I run the same command via a webpage, the text file

    > does
    > > not
    > > > generate. My first impression was that the permissions were wrong. So,

    > I
    > > > gave the web user and the user making the call the necessary

    > > permissions...
    > > > no luck. Here's what I'm doing...
    > > >
    > > > $command = "psexec.exe -i -w C:/Folder -u user -p pass -e
    > > > C:/Folder/executable.exe 2>&1";
    > > > exec ($command);
    > > > ?>
    > > >
    > > > This should generate this file but doesn't: C:/Folder/printer_list.txt
    > > >
    > > > Again, when this exact statement is run in the terminal on the Win2k3
    > > > server, it works fine. Any thoughts?
    > > >
    > > > Thanks in advance,
    > > > ~Philip
    > > >
    > > > PS... Side note: the list rejected my original email b/c of the

    > subject:
    > > > 'Psexec'. Odd.

    > >
    > > Maybe you need the full path to psexec.exe
    > >
    > > Or the web server isn't allowed to use exec due to safemode
    > > http://php.he.net/manual/en/features....functions.php
    > > or disable_functions in php.ini.

    >
    >
    > Those are good suggestions. Unfortunately, I did try the full path to
    > psexec.exe, safe_mode is NOT enabled and there are no functions listed as
    > disabled.
    >
    > I have Google'd, but haven't been successful finding a solution. Anything
    > else? =/



    Maybe try the command with the backtick operator instead of exec...

    David


  5. Default RE: [PHP] p-s-e-x-e-c


    > When I run the command on the server itself, it
    > works just fine. When I run the same command via a webpage, the text file
    > does not generate.



    I also have a similar problem but reversed. It works in a webpage but not on the command line.
    mysql_connect, mssql_connect, and a non-db function.
    A command line script calling file() to call the web page works however.
    And it just stopped working about 2 months ago (from the command line).

    _________________________________________________________________
    Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
    http://www.cafemessenger.com/info/in...M_OctWLtagline

  6. Default Re: [PHP] p-s-e-x-e-c

    On 10/18/07, Instruct ICC <instructicc@hotmail.com> wrote:
    >
    > > When I run the command on the server itself, it
    > > works just fine. When I run the same command via a webpage, the text file
    > > does not generate.

    >
    >
    > I also have a similar problem but reversed. It works in a webpage but not on the command line.
    > mysql_connect, mssql_connect, and a non-db function.
    > A command line script calling file() to call the web page works however.
    > And it just stopped working about 2 months ago (from the command line).


    one word: permissions

    i had issues with db stuff working on web vs. not on shell (or vice
    versa) - turns out the mysql.sock file couldn't be read from one but
    could from the other.

    this would be the first thing i check for the db issues, and the ps
    aux issues. perhaps the webuser doesn't have access, or it isn't in
    $PATH. try full /bin/ps aux and see if that works.

    also perhaps the php.ini settings are different for either one, and
    there's a different ini file for shell vs. web.

  7. Default RE: [PHP] p-s-e-x-e-c


    > > > When I run the command on the server itself, it
    > > > works just fine. When I run the same command via a webpage, the text file
    > > > does not generate.

    > >
    > >
    > > I also have a similar problem but reversed. It works in a webpage but not on the command line.
    > > mysql_connect, mssql_connect, and a non-db function.
    > > A command line script calling file() to call the web page works however..
    > > And it just stopped working about 2 months ago (from the command line).

    >
    > one word: permissions
    >...
    > also perhaps the php.ini settings are different for either one, and
    > there's a different ini file for shell vs. web.


    Even though the build date was before the time the problem started, I scrutinized both the phpinfo's which pointed to the same php.ini, but I noticed that the ./configure switches did not match up and finally the admin admitted that his yum update must have overwritten the formerly manually compiledversion.

    My issue is resolved. Sorry for the partial hijacking of this thread but as you can see, it can be beneficial.

    _________________________________________________________________
    Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare!
    http://onecare.live.com/standard/en-...wl_hotmailnews

+ Reply to Thread