2

I'm running a php script through the webserver to execute psexec which in turns executes another php script.

When I run this from the command line normally, everything works fine and there are no problems.

However, when I run it from the webserver, I get this:

PsExec v1.98 - Execute processes remotely Copyright (C) 2001-2010 Mark Russinovich Sysinternals - www.sysinternals.com php exited with error code 1. 

So from this I can obviously tell that psexec is running properly, but for some reason the php script is exiting. Like I said, though, if I run it manually from the command line, it works perfectly.

I tried to do a bit of looking around, but I can't figure it out. Does anyone know?

I'm running Apache2 (XAMPP) on Windows 2008

1 Answer 1

0

Error codes returned by PsExec are specific to the applications you execute, not PsExec. If psexec successfully connects and runs the target program it will return the errorlevel from that program. 0 is usually success, 1 is usually incorrect/invalid/fail.

What are you trying to accomplish? Maybe you can setup a scheduled task to run the script or some other method of launching it. Maybe the service account running apache does not have execute permissions on the script?

EDIT: also try adding the -accepteula flag to the psexec command in your PHP code. It may be getting hung on accepting the EULA

9
  • How would I go about giving it execute permissions, or even finding out which account is running apache? Commented Oct 7, 2011 at 19:24
  • Task manager, show processes from all users. Then Right click the script > properties > security/permissions and add give that account full control. Commented Oct 7, 2011 at 19:27
  • I had the accepteula problem prior to this, but another helpful user helped me solve that. I'll look into the execution permissions Commented Oct 7, 2011 at 19:29
  • It's also possible apache account doesn't have permissions to execute psexec. Can you launch something else like Notepad from your php code? relevant, you might want to try this registry modification (2nd post from bottom): forum.sysinternals.com/… Commented Oct 7, 2011 at 19:32
  • As for your first idea: http://img843.imageshack.us/img843/7480/ss20111007153532.png apache does seem to have permissions to execute everything. The PHP script seems to execute psexec just fine, but then psexec gets an error code from the php script that psexec executes. (Hope you could follow all that, it got a bit repetitive) Commented Oct 7, 2011 at 19:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.