PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > p-s-e-x-e-c
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
p-s-e-x-e-c

Réponse
 
LinkBack Outils de la discussion
Vieux 18/10/2007, 16h12   #1
Philip Thompson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.

  Réponse avec citation
Vieux 18/10/2007, 18h22   #2
Instruct ICC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 18/10/2007, 19h37   #3
Philip Thompson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
Vieux 18/10/2007, 19h41   #4
David Giragosian
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
Vieux 18/10/2007, 21h09   #5
Instruct ICC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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).

__________________________________________________ _______________
yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/in...M_OctWLtagline
  Réponse avec citation
Vieux 18/10/2007, 21h16   #6
mike
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.
  Réponse avec citation
Vieux 19/10/2007, 21h10   #7
Instruct ICC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h46.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17187 seconds with 15 queries