[PHP] shell_exec fails to compile java class?

2009-11-01 Thread דניאל דנון
Hello!

I need to use shell_exec (or any other similar function) in order to compile
a java class-file.

I have all the needed components installed on my computer (Windows XP with
Java SDK) - I can use "java c:\path" in order to compile using
Start->Run.

When I try to do the same with shell_exec or `` it returns null and it
doesn't compiles. Even when there are errors - it doesn't show them at all.

I've tried to use instead of "java c:\path..." the full java command line
compiler path but it didn't work either.


When I try functions such as "echo test" it works.


Clearly I'm missing here something - problem is... what?

-- 
Use ROT26 for best security


Re: [PHP] shell_exec problem with bsdtar

2009-05-14 Thread Lester Caine

Lester Caine wrote:
I'm trying to emulate Linux facilities on the windows servers, and have 
found bsdtar can be renamed tar.exe so that it will work the same as a 
shell_exec( "tar" ) call in Linux.


The full paths are used to the files and the command line returns the 
extracted file name when run at a command prompt, and similar commands 
for unzip and unrar work fine, later in the check list, but using the 
'tar' and also 'bsdtar' command simply returns NULL, and the extracted 
file is not created.


Any ideas what I've got wrong?


OK - had a sleep on it, and started again fresh.

The bottom line is that WHAT shell_exec returns is rather variable. 
There is a comment about returning windows errors on the manual page, 
but in fact 2> may not JUST contain errors, it also has the normal 
return from some programs. So 2> 'output' may be generally required to 
find out what has been returned, if the shell_exec return is NULL.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec problem with bsdtar

2009-05-13 Thread Lester Caine
I'm trying to emulate Linux facilities on the windows servers, and have 
found bsdtar can be renamed tar.exe so that it will work the same as a 
shell_exec( "tar" ) call in Linux.


The full paths are used to the files and the command line returns the 
extracted file name when run at a command prompt, and similar commands 
for unzip and unrar work fine, later in the check list, but using the 
'tar' and also 'bsdtar' command simply returns NULL, and the extracted 
file is not created.


Any ideas what I've got wrong?

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec - asynchronous would be cool!

2009-02-18 Thread Ashley Sheridan
On Thu, 2009-02-19 at 11:15 +1300, German Geek wrote:
> Yes, believe it or not, when i was writing this, i thought about a db soln
> as well. Just hadnt done it that way back then.
> 
> I guess with Linux one could do something like:
> 
> shell_exec('{longexecutingprogram -with -params; mysql -uuser -ppass
> database query; } &');
> 
> Surely it should be possible in windows as well somehow. Does anyone know
> how (easily)? I mean i could write a win32 executable that could do it but
> that might be overkill.
> 
> But still you have to continuously check the database if the value is the
> expected which seems kind of unelegant.
> 
> Or, you could call a php script at the end like so:
> shell_exec('{longexecutingprogram -with -params; php myscript.php with
> params; } &');
> 
> In myscript.php you could have something like:
> 
>  // send request back to user whos ip and headers would have to be saved and
> sent.
> 
> ?>
> 
> Would this work? Maybe one could write a library for that directly in php...
> 
> So you could actually have a exec_async function without having to write a
> php module or something like that. I would be interested in writing a php
> module at some point anyway though. I know c(++), so it should be doable.
> 
> Is it possible to retrieve the session variables of a user in php cli?
> 
> Regards,
> Tim
> 
> Tim-Hinnerk Heuer
> 
> http://www.ihostnz.com
> George Burns  - "I would go out with women my age, but there are no women my
> age."
> 
> 2009/2/19 Ashley Sheridan 
> 
> > On Thu, 2009-02-19 at 10:30 +1300, German Geek wrote:
> > > Hi all,
> > >
> > > A while ago, i had a problem with shell_exec:
> > >
> > > I was writing some code to execute imagemagick to convert a bunch of
> > images.
> > > This could take ages to execute and the page therefore ages to load. The
> > > solution was to get a linux box and append a & at the end to do it in the
> > > background or make a ajax call to a page that does it in batches. The
> > > problem was really that i had to write a file that is then checked
> > against
> > > to know when it was finished... Not very pretty.
> > >
> > > Anyway, would it be possible to make a "new" shell_exec_async function in
> > > php that just starts the process, puts it to the background and calls a
> > > callback function or another script with parameters when it finishes? I
> > > guess a callback function is not really going to work because the page
> > needs
> > > to finish execution. It should be possible with PHP forking though.
> > >
> > > Anyway, just an idea.
> > >
> > > Regards,
> > > Tim
> > >
> > > Tim-Hinnerk Heuer
> > >
> > > http://www.ihostnz.com
> > > Emo Philips  - "I was the kid next door's imaginary friend."
> >
> > What about calling a shell script with the exec call, and as the last
> > instruction (or continually throughout its execution) it can update a
> > database entry. Your PHP code can then look to see if said entry either
> > exists or is in the right state. It should be faster and prettier than
> > writing a file.
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
I think the only way to do that would be to have a (don't know the
Windows terminology) daemon sitting on the system just continually
checking against the db/file and then it can make a call to the PHP. If
your site has a high volume of traffic, and extra DB call every now and
again won't hurt it too much. I use this for sites sometimes where I
just need something done once a day.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec - asynchronous would be cool!

2009-02-18 Thread German Geek
Yes, believe it or not, when i was writing this, i thought about a db soln
as well. Just hadnt done it that way back then.

I guess with Linux one could do something like:

shell_exec('{longexecutingprogram -with -params; mysql -uuser -ppass
database query; } &');

Surely it should be possible in windows as well somehow. Does anyone know
how (easily)? I mean i could write a win32 executable that could do it but
that might be overkill.

But still you have to continuously check the database if the value is the
expected which seems kind of unelegant.

Or, you could call a php script at the end like so:
shell_exec('{longexecutingprogram -with -params; php myscript.php with
params; } &');

In myscript.php you could have something like:



Would this work? Maybe one could write a library for that directly in php...

So you could actually have a exec_async function without having to write a
php module or something like that. I would be interested in writing a php
module at some point anyway though. I know c(++), so it should be doable.

Is it possible to retrieve the session variables of a user in php cli?

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
George Burns  - "I would go out with women my age, but there are no women my
age."

2009/2/19 Ashley Sheridan 

> On Thu, 2009-02-19 at 10:30 +1300, German Geek wrote:
> > Hi all,
> >
> > A while ago, i had a problem with shell_exec:
> >
> > I was writing some code to execute imagemagick to convert a bunch of
> images.
> > This could take ages to execute and the page therefore ages to load. The
> > solution was to get a linux box and append a & at the end to do it in the
> > background or make a ajax call to a page that does it in batches. The
> > problem was really that i had to write a file that is then checked
> against
> > to know when it was finished... Not very pretty.
> >
> > Anyway, would it be possible to make a "new" shell_exec_async function in
> > php that just starts the process, puts it to the background and calls a
> > callback function or another script with parameters when it finishes? I
> > guess a callback function is not really going to work because the page
> needs
> > to finish execution. It should be possible with PHP forking though.
> >
> > Anyway, just an idea.
> >
> > Regards,
> > Tim
> >
> > Tim-Hinnerk Heuer
> >
> > http://www.ihostnz.com
> > Emo Philips  - "I was the kid next door's imaginary friend."
>
> What about calling a shell script with the exec call, and as the last
> instruction (or continually throughout its execution) it can update a
> database entry. Your PHP code can then look to see if said entry either
> exists or is in the right state. It should be faster and prettier than
> writing a file.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>


Re: [PHP] shell_exec - asynchronous would be cool!

2009-02-18 Thread Ashley Sheridan
On Thu, 2009-02-19 at 10:30 +1300, German Geek wrote:
> Hi all,
> 
> A while ago, i had a problem with shell_exec:
> 
> I was writing some code to execute imagemagick to convert a bunch of images.
> This could take ages to execute and the page therefore ages to load. The
> solution was to get a linux box and append a & at the end to do it in the
> background or make a ajax call to a page that does it in batches. The
> problem was really that i had to write a file that is then checked against
> to know when it was finished... Not very pretty.
> 
> Anyway, would it be possible to make a "new" shell_exec_async function in
> php that just starts the process, puts it to the background and calls a
> callback function or another script with parameters when it finishes? I
> guess a callback function is not really going to work because the page needs
> to finish execution. It should be possible with PHP forking though.
> 
> Anyway, just an idea.
> 
> Regards,
> Tim
> 
> Tim-Hinnerk Heuer
> 
> http://www.ihostnz.com
> Emo Philips  - "I was the kid next door's imaginary friend."

What about calling a shell script with the exec call, and as the last
instruction (or continually throughout its execution) it can update a
database entry. Your PHP code can then look to see if said entry either
exists or is in the right state. It should be faster and prettier than
writing a file.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec - asynchronous would be cool!

2009-02-18 Thread German Geek
Hi all,

A while ago, i had a problem with shell_exec:

I was writing some code to execute imagemagick to convert a bunch of images.
This could take ages to execute and the page therefore ages to load. The
solution was to get a linux box and append a & at the end to do it in the
background or make a ajax call to a page that does it in batches. The
problem was really that i had to write a file that is then checked against
to know when it was finished... Not very pretty.

Anyway, would it be possible to make a "new" shell_exec_async function in
php that just starts the process, puts it to the background and calls a
callback function or another script with parameters when it finishes? I
guess a callback function is not really going to work because the page needs
to finish execution. It should be possible with PHP forking though.

Anyway, just an idea.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Emo Philips  - "I was the kid next door's imaginary friend."


Re: [PHP] shell_exec seems to hang other web requests while running convert

2008-12-23 Thread Nathan Nobbe
On Tue, Dec 23, 2008 at 1:18 AM, German Geek  wrote:

> We can live with the fact that it will take a little longer to process the
> images. The image processing is only done by 2 people, about once a month,
> just to save them time (they would do it with photoshop otherwise and it is
> really boring and time consuming).


oic


> In fact, i might set up an automatic email when its finished. :-)


nice


> In the future it might become an issue when people can edit their own
> ebooks. This project dates back to 1999, so a lot of it is legacy (a binary
> page definition data format...). We're thinking of moving to swf pages
> instead of images, as they currently are, that will reduce the time to be
> taken to convert a pdf by thousands and would increase the quality and
> reduce download times for end users, but it will take time to develop which
> is not at hand atm.
>


> We have been thinking about scaling issues as well for quite some time
> now...
> It was hard enough to get them to move to Linux, since i work in a .NET
> shop...
> Setting up load balancing is not a trivial task though and expensive to
> host.


it'll take up another 1u, but we run the older alteon load balancers which
can be had pretty cheaply from ebay,

http://shop.ebay.com/?_from=R40&_trksid=m38.l1313&_nkw=alteon&_sacat=See-All-Categories


> I'm the main software developer on this project and am too busy adding
> features and debugging ActionScript, C++ and PHP code to do that as well.


good times.

thanks for elaborating, sounds like things are well in hand.  and a merry
christmas to you too ;D

-nathan


Re: [PHP] shell_exec seems to hang other web requests while running convert

2008-12-23 Thread German Geek
We can live with the fact that it will take a little longer to process the
images. The image processing is only done by 2 people, about once a month,
just to save them time (they would do it with photoshop otherwise and it is
really boring and time consuming). In fact, i might set up an automatic
email when its finished. :-)

In the future it might become an issue when people can edit their own
ebooks. This project dates back to 1999, so a lot of it is legacy (a binary
page definition data format...). We're thinking of moving to swf pages
instead of images, as they currently are, that will reduce the time to be
taken to convert a pdf by thousands and would increase the quality and
reduce download times for end users, but it will take time to develop which
is not at hand atm.

We have been thinking about scaling issues as well for quite some time
now...
It was hard enough to get them to move to Linux, since i work in a .NET
shop...
Setting up load balancing is not a trivial task though and expensive to
host. I'm the main software developer on this project and am too busy adding
features and debugging ActionScript, C++ and PHP code to do that as well.

Thanks for your thoughts though.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com


On Tue, Dec 23, 2008 at 7:41 PM, Nathan Nobbe wrote:

> On Mon, Dec 22, 2008 at 11:34 PM, German Geek  wrote:
>
>> cron is a good idea, havent thought about that. One could use the nice
>> program then to give it the lowest priority, because other requests are more
>> important than this and another server gives the issue of transfering files
>> back and forth. Another soln would be to run it with & in the background
>> (with nice) and then check if the file(s) exist on ajax calls to give
>> feedback, this might actually be easier to implement.
>
>
> nice'ing the process is a good idea, however, youll only prolong the time
> it will take to accomplish those img manipulation tasks, and soon you'll
> find yourself w/ a nice little backlog on your hands.
>
> what sounds to me to be the larger issue is pushing the limit on a single
> box.  in order to scale, youll need to spread the load somehow.  you can
> dodge the bullet now, but it will be back, if your sites popularity is
> growing.
>
> just my 2c
>
> -nathan
>
>


Re: [PHP] shell_exec seems to hang other web requests while running convert

2008-12-22 Thread Nathan Nobbe
On Mon, Dec 22, 2008 at 11:34 PM, German Geek  wrote:

> cron is a good idea, havent thought about that. One could use the nice
> program then to give it the lowest priority, because other requests are more
> important than this and another server gives the issue of transfering files
> back and forth. Another soln would be to run it with & in the background
> (with nice) and then check if the file(s) exist on ajax calls to give
> feedback, this might actually be easier to implement.


nice'ing the process is a good idea, however, youll only prolong the time it
will take to accomplish those img manipulation tasks, and soon you'll find
yourself w/ a nice little backlog on your hands.

what sounds to me to be the larger issue is pushing the limit on a single
box.  in order to scale, youll need to spread the load somehow.  you can
dodge the bullet now, but it will be back, if your sites popularity is
growing.

just my 2c

-nathan


Re: [PHP] shell_exec seems to hang other web requests while running convert

2008-12-22 Thread German Geek
cron is a good idea, havent thought about that. One could use the nice
program then to give it the lowest priority, because other requests are more
important than this and another server gives the issue of transfering files
back and forth. Another soln would be to run it with & in the background
(with nice) and then check if the file(s) exist on ajax calls to give
feedback, this might actually be easier to implement.

Anyway, we will fix the issue later now. Thanks.

Tim-Hinnerk Heuer

http://www.ihostnz.com


On Tue, Dec 23, 2008 at 7:21 PM, Nathan Nobbe wrote:

> On Mon, Dec 22, 2008 at 9:06 PM, German Geek  wrote:
>
>> Hi All,
>>
>> The following problem:
>>
>> Our client is converting pdfs to images with a web interface. At the
>> moment
>> I'm using convert from imagemagick with shell_exec (i know i could use the
>> imagick module, but this would require quite a bit of recoding and time at
>> the moment, it was originally running on a windows machine and i couldnt
>> get
>> the imagick module working on that).
>
>
> wow, i totally here you on the we cant change our imagemagick setup right
> now ;)
>
> But still while these 3
>> images are converted (can take 20-30 seconds) other requests seem to hang
>> until convert is finished. I know, i can put a & at the end of the command
>> line but then they wouldnt know when the process is actually finished.
>
>
> its very common to treat objectives which take more time to complete in an
> asynchronous manner.  typically the http request will place a 'command' into
> a queue, which is picked up by a cron job.  then the user is notified upon
> completion by an email or some other web page, which they can go to review
> at a later time.
>
> this will not help your server load at all however, if youve only got 1
> box.  the cron will be running and eating juice that the webserver would
> like to have.  best bet is to scale out by tossing another server in the mix
> to handle the imagemagick stuff.  whether or not you want to keep things
> real-time or move to a cron-based solution is up to you.
>
> -nathan
>
>


Re: [PHP] shell_exec seems to hang other web requests while running convert

2008-12-22 Thread Nathan Nobbe
On Mon, Dec 22, 2008 at 9:06 PM, German Geek  wrote:

> Hi All,
>
> The following problem:
>
> Our client is converting pdfs to images with a web interface. At the moment
> I'm using convert from imagemagick with shell_exec (i know i could use the
> imagick module, but this would require quite a bit of recoding and time at
> the moment, it was originally running on a windows machine and i couldnt
> get
> the imagick module working on that).


wow, i totally here you on the we cant change our imagemagick setup right
now ;)

But still while these 3
> images are converted (can take 20-30 seconds) other requests seem to hang
> until convert is finished. I know, i can put a & at the end of the command
> line but then they wouldnt know when the process is actually finished.


its very common to treat objectives which take more time to complete in an
asynchronous manner.  typically the http request will place a 'command' into
a queue, which is picked up by a cron job.  then the user is notified upon
completion by an email or some other web page, which they can go to review
at a later time.

this will not help your server load at all however, if youve only got 1
box.  the cron will be running and eating juice that the webserver would
like to have.  best bet is to scale out by tossing another server in the mix
to handle the imagemagick stuff.  whether or not you want to keep things
real-time or move to a cron-based solution is up to you.

-nathan


[PHP] shell_exec seems to hang other web requests while running convert

2008-12-22 Thread German Geek
Hi All,

The following problem:

Our client is converting pdfs to images with a web interface. At the moment
I'm using convert from imagemagick with shell_exec (i know i could use the
imagick module, but this would require quite a bit of recoding and time at
the moment, it was originally running on a windows machine and i couldnt get
the imagick module working on that).

Is there a quick way to give other web requests to the web server a higher
priority than this process? It can take quite a while to convert 100 pdf
pages to images in high res with convert. At the moment only 3 images at a
time are converted with some crazy ajax logic. But still while these 3
images are converted (can take 20-30 seconds) other requests seem to hang
until convert is finished. I know, i can put a & at the end of the command
line but then they wouldnt know when the process is actually finished.

The server is an ubuntu server with the latest release. It's got Apache:
Apache/2.2.8 (Ubuntu) mod_mono/2.0 PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch
mod_ssl/2.2.8 OpenSSL/0.9.8g Server at 208.79.206.58 Port 80

Please help. This is rather urgent and needs to be working properly
preferably before xmas. Anyway, merry xmas to everyone in case i forget to
say that later :-).

Tim-Hinnerk Heuer

http://www.ihostnz.com


Re: [PHP] shell_exec, batch files, and IIS on Windows

2007-02-27 Thread Shu Chow
Thanks, guys, for the responses.  I'll check the events and IIS logs 
tomorrow.  This afternoon, I put the IIS user into the Administrators 
group, but no luck - the same exact thing, or lack of thing, happened. I 
told this to the IT head and he agrees that it's probably not a 
permissions issue.  After that he kind of warmed up to installing Apache 
on that box.  They're absolutely not anti-Apache, just overworked and 
understaffed :/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec, batch files, and IIS on Windows

2007-02-27 Thread Richard Lynch
On Tue, February 27, 2007 2:59 pm, Shu Chow wrote:
> The manual entry for shell_exec has a comment that notes to execute
> .bat
> files with shell_exec, you need to pass the command through cmd.exe
> with
> the /c argument.  I was wondering if anyone could share some insight
> on
> why that is.
>
> I've pretty much verified that this is the case.  I can't execute .bat
> files at all from a Windows 2003 server running IIS.  I can locally on
> my development workstation (XP running Apache).  I've tried passing
> the
> command through cmd.exe on the server, but some of the commands in the
> .bat file does not run properly when going through cmd.exe.
>
> I suspect that IIS is a key culprit, but I have nothing concrete.  I'd
> like to take a plausible theory to the IT guys before I request that
> they install Apache on that box.
>
> Thanks for any insight anyone might have.

No real insight, but a couple philosophical questions that may lead
somebody who actually does Windows into something...

When one runs a .bat file, isn't one already *IN* some kind of cmd.exe
shell of some type to start with?

OTOH, what is PHP doing with exec() on Windows if not firing up some
kind of cmd.exe shell?

You could run a test with Apache/Windows/exec fairly quickly on any
box, without hitting the IT guys up with the request.  Have proof in
hand that IIS is culprit and Apache is saviour. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] shell_exec, batch files, and IIS on Windows

2007-02-27 Thread Vincent DUPONT


hi,

maybe you can try this:
in the IIS properties, you can define the user running your IIS service. 
Ususally this is IUSR_xxx, but you can set a administrator user (see directory 
Security/ anonymous user)
try to put your win login (prefixed with your domain\ and give your password.

If you can execute your cmd and batch file, then you can be sure that the 
problem if an authorisation problem.
Afterward, re-enter the IUSR_xx user as the anonymous user, because running as 
administrator is rather dangerous!!

Also, try the 'Integrated windows Authentication', if this is checked, the 
anaonymous will NOY be used, but your own login will be used instead.
As an example, if the Use integrated authentication is active, try a phpinfo() 
and you should find your own windows login as AUTH_USER (or others, don't 
remember).
(if you have a login prompt, you can avoid it from the IE setting)


Also, have a look at the event viewer and at the IIS log file. Maybe you will 
see the error reported by IIS...


Vincent Dupont
Principal Consultant OpenSource Competence Center
Ausy Belgium
http://www.ausy.be



-Original Message-
From: Frank M. Kromann [mailto:[EMAIL PROTECTED]
Sent: Tue 2/27/2007 22:20
To: Shu Chow
Cc: php-general@lists.php.net
Subject: Re: [PHP] shell_exec, batch files, and IIS on Windows
 
The user that runs the php script under iis (IUSER_) should
have permissions to execute  the cmd.exe file, the .bat file and all the
commands included in the .bat file.

- Frank

> The manual entry for shell_exec has a comment that notes to execute .bat

> files with shell_exec, you need to pass the command through cmd.exe with

> the /c argument.  I was wondering if anyone could share some insight on

> why that is.
> 
> I've pretty much verified that this is the case.  I can't execute .bat 
> files at all from a Windows 2003 server running IIS.  I can locally on 
> my development workstation (XP running Apache).  I've tried passing the

> command through cmd.exe on the server, but some of the commands in the 
> .bat file does not run properly when going through cmd.exe.
> 
> I suspect that IIS is a key culprit, but I have nothing concrete.  I'd 
> like to take a plausible theory to the IT guys before I request that 
> they install Apache on that box.
> 
> Thanks for any insight anyone might have.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec, batch files, and IIS on Windows

2007-02-27 Thread Frank M. Kromann
The user that runs the php script under iis (IUSER_) should
have permissions to execute  the cmd.exe file, the .bat file and all the
commands included in the .bat file.

- Frank

> The manual entry for shell_exec has a comment that notes to execute .bat

> files with shell_exec, you need to pass the command through cmd.exe with

> the /c argument.  I was wondering if anyone could share some insight on

> why that is.
> 
> I've pretty much verified that this is the case.  I can't execute .bat 
> files at all from a Windows 2003 server running IIS.  I can locally on 
> my development workstation (XP running Apache).  I've tried passing the

> command through cmd.exe on the server, but some of the commands in the 
> .bat file does not run properly when going through cmd.exe.
> 
> I suspect that IIS is a key culprit, but I have nothing concrete.  I'd 
> like to take a plausible theory to the IT guys before I request that 
> they install Apache on that box.
> 
> Thanks for any insight anyone might have.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP shell_exec

2007-02-27 Thread Richard Lynch
On Tue, February 27, 2007 7:17 am, h wrote:
> I have been using the shell_exec command to perform several server
> queries quite succesfully i.e. analysing files systems by gettin
> ginformation returned by df -kP (shell_exec('df -kP')).  do any of you
> guts know if it is possible to target a command like this on another
> server?
>
> So from server A where I am running a web app, needs to run the
> shell_exec('df -kP') on server B, which also has php installed, so
> that i can display the results in my web app on server A.  Hope that
> makes sense!
>
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from
> Server A.

Well, there are several options here.

One option is to just build a password-protected web page on the other
server that does the exec() (or readfile for cpuinfo).  Then you can
have PHP on server A do file_get_contents on the URL, if
allow_url_fopen is "ON"

Depending on how complex the target command is, you could also look
into running WebServices such as SOAP, RPC, REST, etc.

A valuable source of this kind of thing is from the zillion "control
panels" for webhosting that are "out there"

I think you might maybe be able to tunnel a command through SSH as a
one-off, but perhaps I'm just dreaming I read about that in man ssh a
few months ago.

To a large degree, HOW you do this depends much more on what commands
you want to allow, and even more importantly, disallow, than on
anything involving PHP.  In fact, PHP itself is only a
thinly-disguised wrapper for whatever you will come up with.  So
you're better off asking about this kind of thing on an OS or Linux
distribution mailing list, probably.  The PHP bit will end up just
being  no matter how you look at it.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec, batch files, and IIS on Windows

2007-02-27 Thread Shu Chow
The manual entry for shell_exec has a comment that notes to execute .bat 
files with shell_exec, you need to pass the command through cmd.exe with 
the /c argument.  I was wondering if anyone could share some insight on 
why that is.


I've pretty much verified that this is the case.  I can't execute .bat 
files at all from a Windows 2003 server running IIS.  I can locally on 
my development workstation (XP running Apache).  I've tried passing the 
command through cmd.exe on the server, but some of the commands in the 
.bat file does not run properly when going through cmd.exe.


I suspect that IIS is a key culprit, but I have nothing concrete.  I'd 
like to take a plausible theory to the IT guys before I request that 
they install Apache on that box.


Thanks for any insight anyone might have.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP shell_exec

2007-02-27 Thread Colin Guthrie
h wrote:
> I have been using the shell_exec command to perform several server queries 
> quite succesfully i.e. analysing files systems by gettin ginformation 
> returned by df -kP (shell_exec('df -kP')).  do any of you guts know if it is 
> possible to target a command like this on another server? 
> 
> So from server A where I am running a web app, needs to run the 
> shell_exec('df -kP') on server B, which also has php installed, so that i can 
> display the results in my web app on server A.  Hope that makes sense!
> 
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server 
> A.

If you need to inspect e.g. free space on remote servers it may be more
sensible to use SNMP or some such similar protocol/system that is
designed for exactly this purpose rather than try to hack up a system in
PHP (tho' I do love my hacking!)

Have a look at Nagios. I'd imagine your servers will have some degree of
health monitoring/reporting installed anyway for your own peace of mind,
so it shouldn't be too hard to hook into that system.

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP shell_exec

2007-02-27 Thread Peter Lauri
ssh2_exec would do it for you...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: h [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 27, 2007 3:18 PM
To: php-general@lists.php.net
Subject: [PHP] PHP shell_exec 

Hi 



I have been using the shell_exec command to perform several server queries
quite succesfully i.e. analysing files systems by gettin ginformation
returned by df -kP (shell_exec('df -kP')).  do any of you guts know if it is
possible to target a command like this on another server? 



So from server A where I am running a web app, needs to run the
shell_exec('df -kP') on server B, which also has php installed, so that i
can display the results in my web app on server A.  Hope that makes sense!



Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
A.



Any help greatly appreciated



Regards



Ade

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP shell_exec

2007-02-27 Thread Andrei

Hi Ade,

Sure you can. You must develop 2 scripts. One that will act as
"server" and one as "client".
So if you want to get details of server B from server A you should
have the "server" into B and "client" into A.
Be sure the communication between these 2 servers is securised
(using a certificate or build you own encryption for communication,
restrict script response depending on server ips etc...) as you want to
pass sensitive data between them.
Communication can be done using curl library or simply with fopen
(if allow_url_fopen allows it). parameters can be passed using XML or
simple parsed plain text.

Andy

h wrote:
> Hi 
>
>
>
> I have been using the shell_exec command to perform several server queries 
> quite succesfully i.e. analysing files systems by gettin ginformation 
> returned by df -kP (shell_exec('df -kP')).  do any of you guts know if it is 
> possible to target a command like this on another server? 
>
>
>
> So from server A where I am running a web app, needs to run the 
> shell_exec('df -kP') on server B, which also has php installed, so that i can 
> display the results in my web app on server A.  Hope that makes sense!
>
>
>
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server 
> A.
>
>
>
> Any help greatly appreciated
>
>
>
> Regards
>
>
>
> Ade
>
> .
>
>   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP shell_exec

2007-02-27 Thread Németh Zoltán
2007. 02. 27, kedd keltezéssel 13.17-kor h ezt írta:
> Hi 
> 
> I have been using the shell_exec command to perform several server queries 
> quite succesfully i.e. analysing files systems by gettin ginformation 
> returned by df -kP (shell_exec('df -kP')).  do any of you guts know if it is 
> possible to target a command like this on another server? 
> 
> So from server A where I am running a web app, needs to run the 
> shell_exec('df -kP') on server B, which also has php installed, so that i can 
> display the results in my web app on server A.  Hope that makes sense!
> 
> Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server 
> A.
> 
> Any help greatly appreciated
> 
> Regards
> 
> Ade

maybe you need ssh2_exec

http://hu.php.net/manual/hu/function.ssh2-exec.php

hope that helps
Zoltán Németh

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP shell_exec

2007-02-27 Thread h
Hi 



I have been using the shell_exec command to perform several server queries 
quite succesfully i.e. analysing files systems by gettin ginformation returned 
by df -kP (shell_exec('df -kP')).  do any of you guts know if it is possible to 
target a command like this on another server? 



So from server A where I am running a web app, needs to run the shell_exec('df 
-kP') on server B, which also has php installed, so that i can display the 
results in my web app on server A.  Hope that makes sense!



Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A.



Any help greatly appreciated



Regards



Ade


Re: [PHP] shell_exec("zip.. ?

2005-08-08 Thread Burhan Khalid

Sam Smith wrote:

shell_exec("zip -r ddd ddd"); // don't work

safe_mode off, works from command line php. What could it be?


You need to give the full path to zip.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec("zip.. ?

2005-08-03 Thread Sam Smith

shell_exec("zip -r ddd ddd"); // don't work

safe_mode off, works from command line php. What could it be?

Details:

drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 18:34 execTest/
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:33 mkdir.php

mkdir.php:


execTest$ php mkdir.php

execTest$ ls -l
drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 18:36 ddd
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php

#OK works from command line php

Let's delete ddd and have the web server run it:
http://dom.com/execTest/mkdir.php

Nope, probably permissions:

execTest$ chmod 777 ../execTest

Try again:
http://dom.com/execTest/mkdir.php

Yup.

Now let's see if we can delete it.
rm.php:


http://dom.com/execTest/rm.php

Yup, makes sense, user httpd created it.

Now let's zip it.
zip.php:


http://dom.com/execTest/zip.php

NOPE can't zip, must be something I don't know.

drwxrwxrwx  3 zamzmith  zamzmith  512 Aug  3 18:49 execTest/
drwxr-xr-x  2 httpd zamzmith  512 Aug  3 18:49 ddd
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:44 rm.php
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:49 zip.php



Let's try it form the command line php:

Delete it first:
execTest$ curl http://ssmith.com/execTest/rm.php
execTest$ php zip.php

Yup:
drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 19:10 ddd
-rw-r--r--  1 zamzmith  zamzmith  264 Aug  3 19:10 ddd.zip
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:44 rm.php
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:49 zip.php


Better check safe_mode anyway:

phpinfo.php:


execTest: php phpinfo.php | grep safe
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sql.safe_mode => Off => Off
Supported ciphers => cast-128 gost rijndael-128 twofish arcfour cast-256
loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent
xtea blowfish enigma rc2 tripledes
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH


Hours lost, any help,

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Shell_exec timeout question

2004-11-11 Thread Rui Francisco
HI,
Does anybody know if its possible to execute a command through exec, 
shell exec, system  and if the program doesn't terminate in N seconds 
returns control to PHP ?

Thanks in advance
Rui Francisco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Shell_exec

2004-04-16 Thread Enrico Weigelt
* Peter Hansen <[EMAIL PROTECTED]> [2004-04-15 20:36:28 +0200]:


> require_once("mainfile.php");
> 
> include("header.php");
> 
> $content =  `/C:/Inetpub/com/html/bf1942live/vietnam.pl`;

Are you working on dos/windows ? 

yes)
win32 does (IMHO) not support external interpreter executables
you then must call `perl /C:/Inetpub/com/html/bf1942live/vietnam.pl`
(probaly fix the perl interpreter location if its not in $PATH)
you probably consider changing the server platform.

no)
your command path is wrong. driver letters only exist on dos/windows.



cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Shell_exec

2004-04-15 Thread Peter Hansen
Hello

i need some help with my battlefield livestat
i have two website
www.flashwebb.se
and
www.flashwebb.com

and the help i need is on the www.flashwebb.com site

You can look here
http://www.flashwebb.se/bf1942live/vietnam.pl

and see it on action

so now i have download the   php nuke
and i want to have the same page  as above wheni click on a link to my new
site

and i been told to make a   php page and put this code  to call the
vietnam.pl



and i save the as bflive.php  and put a link to it on my page
so now when i click on the link
i get this erromessage
Warning: shell_exec(): Unable to execute
'/C:/Inetpub/com/html/bf1942live/vietnam.pl' in
C:\Inetpub\Com\html\bflive.php on line 7

You can see for your self here
http://www.flashwebb.com/bflive.php

so now i don't know what's wrong
i want the page  vietnam.pl to come up when i click on the link
as you can do can see here
http://www.flashwebb.se/bf1942live/vietnam.pl

Anyone who can help me here???
Regards
Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec and accents

2004-01-29 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hi,

I'm using shell_exec to call a command that can return accented
characters.  Unfortunately the accented characters are being transformed
into other characters instead (for example, an acute e becomes a ',').

How can I get the real output?

I'm running on Windows 2000.  In the command prompt the command returns
the accents correctly.

Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec and accents

2004-01-29 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hi,

I'm using shell_exec to call a command that can return accented
characters.  Unfortunately the accented characters are being transformed
into other characters instead (for example, an acute e becomes a ',').

How can I get the real output?

I'm running on Windows 2000.  In the command prompt the command returns
the accents correctly.

Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-16 Thread Jason Wong
On Thursday 13 November 2003 16:51, Mario Ohnewald wrote:

[snip]

> ==
> Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
> AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int
> AF_pre: 44100Hz 2ch Signed 16-bit (Little-Endian)
> audio_setup: Can't open audio device /dev/dsp: Permission denied
> AO: [null] 44100Hz 2ch Signed 16-bit (Little-Endian) (2 bps)
> Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
> Starting playback...
>
>
> Exiting... (End of
> file)
>
> ---
>---
>
>
> So php kind of exits after the == chars.
> Any further ideas?

Let's try a change of tack. I believe you wanted to extract some info from an 
MPEG file? So look for a program which does simply that, ie without trying to 
play the damn thing. There is a project based on PHP which extracts various 
info from various format multimedia files. That may or may not do what you 
want. You can find it on freshmeat.net. 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Don't get mad, get even.
-- Joseph P. Kennedy

Don't get even, get jewelry.
-- Anonymous
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-13 Thread Mario Ohnewald
Hello!
I think we are almost there yet :)

> On Wednesday 12 November 2003 21:48, Mario Ohnewald wrote:
> 
> > ok, i am running the script like this now:
> 
> [snip]
> 
> This seems to suggest that shell_exec() does not like your command and is
> not 
> executing it, so:
> 
> Try tackling it logically, step-by-step:
> 
> > > Have you:
> > >
> > > 1) Turned on full error reporting?
> >
> > How do i turn that on?
> 
> In php.ini, once you've enabled it, restart webserver and see what errors,
> if 
> any, you get.
ok, i have enabled that with error_reporting(E_ALL); 

> 
> > > 2) Checked that (i) you're not running in safe_mode, or (ii) if you
> are,
> > > that
> > > you are allowed to access those executables?
> >
> > i am running in safe mode.
> 
> What is the answer to (ii)?
Yes, i do have acces to those files and the permissions are correct.

> 
> Are you able to execute any shell programs/commands at all? Hint try
> something 
> simple like shell_exec('touch /tmp/testfile') and see whether
> /tmp/testfile 
> is being created.
Yes, i am. 

I think the key is here somewhere:
PHP Output from shell_exec("/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg");


MPlayer 1.0pre2-3.3.2 (C) 2000-2003 MPlayer Team

CPU: Advanced Micro Devices Athlon MP/XP Thoroughbred 1466 MHz (Family: 6,
Stepping: 1)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

Reading config file /usr/local/etc/mplayer/mplayer.conffont: can't open
file: (null)
font: can't open file: /usr/local/share/mplayer/font/font.desc
Using usleep() timing

Playing /tmp/pitstop.mpeg
MPEG-PS file format detected.
VIDEO:  MPEG1  320x240  (aspect 1)  29.970 fps  1151.2 kbps (143.9 kbyte/s)



PHP Output from normal shell /usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg

MPlayer 1.0pre2-3.3.2 (C) 2000-2003 MPlayer Team

CPU: Advanced Micro Devices Athlon MP/XP Thoroughbred 1466 MHz (Family: 6,
Stepping: 1)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

Reading config file /usr/local/etc/mplayer/mplayer.conf: No such file or
directory
Reading config file /home/lansinplayer/.mplayer/config
Reading /home/lansinplayer/.mplayer/codecs.conf: Can't open
'/home/lansinplayer/.mplayer/codecs.conf': No such file or directory
Reading /usr/local/etc/mplayer/codecs.conf: Can't open
'/usr/local/etc/mplayer/codecs.conf': No such file or directory
Using built-in default codecs.conf
font: can't open file: /home/lansinplayer/.mplayer/font/font.desc
font: can't open file: /usr/local/share/mplayer/font/font.desc
Failed to open /dev/rtc: Permission denied (mplayer should be setuid root or
/dev/rtc should be readable by the user.)
Using usleep() timing
Can't open input config file /home/lansinplayer/.mplayer/input.conf: No such
file or directory
Can't open input config file /usr/local/etc/mplayer/input.conf: No such file
or directory
Falling back on default (hardcoded) input config

Playing /tmp/pitstop.mpeg
MPEG-PS file format detected.
VIDEO:  MPEG1  320x240  (aspect 1)  29.970 fps  1151.2 kbps (143.9 kbyte/s)
==
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
MP3lib: init layer2&3 finished, tables done
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 16000->176400 (128.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
==
ID_FILENAME=/tmp/pitstop.mpeg
ID_VIDEO_FORMAT=0x1001
ID_VIDEO_BITRATE=1151200
ID_VIDEO_WIDTH=320
ID_VIDEO_HEIGHT=240
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=0.
ID_AUDIO_CODEC=mp3
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_LENGTH=16
vo: couldn't open the X11 display ()!
vo: couldn't open the X11 display ()!
VO XOverlay need a subdriver
vo: couldn't open the X11 display ()!
Can't open /dev/fb0: Permission denied
[fbdev2] Can't open /dev/fb0: Permission denied
==
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 320 x 240 (preferred csp: Mpeg PES)
VDec: using Mpeg PES as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [null] 320x240 => 320x240 Mpeg PES
Selected video codec: [mpegpes] vfm:mpegpes (Mpeg PES output (.mpg or
Dxr3/DVB card))
==
Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int
AF_pre:

Re: [PHP] shell_exec with pipes

2003-11-13 Thread Jason Wong
On Wednesday 12 November 2003 21:48, Mario Ohnewald wrote:

> ok, i am running the script like this now:

[snip]

This seems to suggest that shell_exec() does not like your command and is not 
executing it, so:

Try tackling it logically, step-by-step:

> > Have you:
> >
> > 1) Turned on full error reporting?
>
> How do i turn that on?

In php.ini, once you've enabled it, restart webserver and see what errors, if 
any, you get.

> > 2) Checked that (i) you're not running in safe_mode, or (ii) if you are,
> > that
> > you are allowed to access those executables?
>
> i am running in safe mode.

What is the answer to (ii)?

Are you able to execute any shell programs/commands at all? Hint try something 
simple like shell_exec('touch /tmp/testfile') and see whether /tmp/testfile 
is being created.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I can't stand squealers; hit that guy.
-- Albert Anastasia
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-12 Thread Mario Ohnewald
ok, i am running the script like this now:
 START -

$var=shell_exec("/home/lansinplayer/server/apache/htdocs/lansinplayer/getfilelength.sh 
/tmp/pitstop.mpeg");
echo "--$var--";
 STOP -
Where echo returns nothing. I did a chmod 777 on the getfilelength.sh file.


When i run the file in shell i get this:
$ /home/lansinplayer/server/apache/htdocs/lansinplayer/getfilelength.sh
/tmp/pitstop.mpeg
16


The Shell file looks like that:
if [ "$1" ];then
length="`mplayer -identify -frames 0 $1 2>/dev/null| grep ID_LENGTH
| cut -d \"=\" -f 2`"
echo $length





> On Wednesday 12 November 2003 17:21, Mario Ohnewald wrote:
> 
> > > $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> > > /tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");
> >
> > $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> > /tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");
> > echo "Output: $var";
> >
> > Still gives nothing back :/
> > Told you, its not that easy :P
> 
> Have you:
> 
> 1) Turned on full error reporting?
How do i turn that on?

> 2) Checked that (i) you're not running in safe_mode, or (ii) if you are,
> that 
> you are allowed to access those executables?
i am running in safe mode.

> 3) Confirmed that the left side of the pipe is working and giving the
> expected 
> output?
$var2=shell_exec("mplayer -identify -frames 0 /tmp/pitstop.mpeg | /bin/grep
ID_LENGTH");
gives nothing back.

Thats what i get in Shell:
-
$ mplayer -identify -frames 0 /tmp/pitstop.mpeg | grep ID_LENGTH
: No such file or directory
Can't open '/home/lansinplayer/.mplayer/codecs.conf': No such file or
directory
Can't open '/usr/local/etc/mplayer/codecs.conf': No such file or directory
Failed to open /dev/rtc: Permission denied (mplayer should be setuid root or
/dev/rtc should be readable by the user.)
Can't open input config file /home/lansinplayer/.mplayer/input.conf: No such
file or directory
Can't open input config file /usr/local/etc/mplayer/input.conf: No such file
or directory
Falling back on default (hardcoded) input config
vo: couldn't open the X11 display ()!
vo: couldn't open the X11 display ()!
VO XOverlay need a subdriver
vo: couldn't open the X11 display ()!
Can't open /dev/fb0: Permission denied
[fbdev2] Can't open /dev/fb0: Permission denied
audio_setup: Can't open audio device /dev/dsp: Permission denied
ID_LENGTH=16



> 4) Tried giving the full path to grep?
yes i did
> 
> If you're still having trouble with it you can try sticking the above into
> a 
> little shell script and shell_exec() the shell script instead.
See above.


Any further ideas?

Thank you, Mario

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-12 Thread Jason Wong
On Wednesday 12 November 2003 17:21, Mario Ohnewald wrote:

> > $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> > /tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");
>
> $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> /tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");
> echo "Output: $var";
>
> Still gives nothing back :/
> Told you, its not that easy :P

Have you:

1) Turned on full error reporting?
2) Checked that (i) you're not running in safe_mode, or (ii) if you are, that 
you are allowed to access those executables?
3) Confirmed that the left side of the pipe is working and giving the expected 
output?
4) Tried giving the full path to grep?

If you're still having trouble with it you can try sticking the above into a 
little shell script and shell_exec() the shell script instead.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Due to lack of disk space, this fortune database has been discontinued.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] shell_exec with pipes

2003-11-12 Thread Mario Ohnewald
Hi,

> $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> /tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");

$var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");
echo "Output: $var";

Still gives nothing back :/
Told you, its not that easy :P


Thank you very much, Mario

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] shell_exec with pipes

2003-11-11 Thread Jay Blanchard
[snip]
> $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0 
> /tmp/pitstop.mpeg 2>/dev/null\| grep ID_LENGTH \| cut -d \"=\" -f 2");
[/snip]

$var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2>/dev/null | grep ID_LENGTH | cut -d \"=\" -f 2");

Try just escaping the quotes, pipes should be OK IIRC.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-11 Thread Mario Ohnewald
> Have you tried escaping the pipes and quotes?  Try this:
> 
> $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0 
> /tmp/pitstop.mpeg 2>/dev/null\| grep ID_LENGTH \| cut -d \"=\" -f 2");

nope, still get nothing back.

> 
> Mario Ohnewald wrote:
> 
> > $var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
> > /tmp/pitstop.mpeg 2>/dev/null| grep ID_LENGTH | cut -d "=" -f 2");
> 

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec with pipes

2003-11-11 Thread Aaron Gould
Have you tried escaping the pipes and quotes?  Try this:

$var=shell_exec("/usr/local/bin/mplayer -identify -frames 0 
/tmp/pitstop.mpeg 2>/dev/null\| grep ID_LENGTH \| cut -d \"=\" -f 2");

Mario Ohnewald wrote:

$var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2>/dev/null| grep ID_LENGTH | cut -d "=" -f 2");
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] shell_exec with pipes

2003-11-11 Thread Mario Ohnewald
Hello List!
I have tried to get this command working with php for about 2Weeks now, and
i would like you to try to get this thing working.

This shell command:
/usr/local/bin/mplayer -identify -frames 0 /tmp/pitstop.mpeg 2>/dev/null|
grep ID_LENGTH | cut -d "=" -f 2

gives me the result "16" back, the LENGHT of the filename.

$var=shell_exec("/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2>/dev/null| grep ID_LENGTH | cut -d "=" -f 2");

just wont for some reason! $var ist just empty.
I was playing around with stderr and stdout and stuff, but i dont know why
php wont deal with it as shell does.

$var=shell_exec("ls -al"); 
for examle works just fine!

Could someone please give it a try, cause i have spent hours in irc channels
and googeling around to get this solved :/



Thanks a LOT!!

Mario

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] shell_exec question - Solved

2003-10-09 Thread Chris Blake
To all who contributed to this thread, many thanks...

I tried all the suggestions offered but still had the same problem.
Today I copied php.ini-dist over to /etc, restarted Apache and
everything works. This process was repeated many times during the last
day or so, so I don`t know what happened to make it work this time.

Anyhowze, my shell_exec`s are working now, so I`m a happy camper...

Thanks again to all who assisted, muchly apreciated.

-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

THE LESSER-KNOWN PROGRAMMING LANGUAGES #10: SIMPLE

SIMPLE is an acronym for Sheer Idiot's Monopurpose Programming Language
Environment.  This language, developed at the Hanover College for
Technological Misfits, was designed to make it impossible to write code
with errors in it.  The statements are, therefore, confined to BEGIN,
END and STOP.  No matter how you arrange the statements, you can't make
a syntax error.  Programs written in SIMPLE do nothing useful.  Thus
they achieve the results of programs written in other languages without
the tedious, frustrating process of testing and debugging.

10:29:53 up 22 days,  1:59,  3 users,  load average: 0.52, 0.19, 0.13

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread John Nichel
Is there a .htaccess file in (or above) the directory that the script is 
in?  If so, look to see if safe mode is turned on there.

Chris Blake wrote:

On Wed, 2003-10-08 at 15:23, Marek Kilimajer wrote:

Then check your httpd.conf for php_(admin_)?(flag|value)



OK, so I`ve tried all the suggestions posted, thanks guys...but then I
went and deleted the php.ini file in /etc, and still when I use
phpinfo(); it gives me the usual phpinfo page...
So where is the info coming from...another php.ini located somewhere
else on my drive ?
A search revealed naddaso I`m out of ideas right now.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
I thought about it, but safe mode can be set only in php.ini or httpd.conf

Burhan Khalid wrote:

Chris Blake wrote:

OK, so I`ve tried all the suggestions posted, thanks guys...but then I
went and deleted the php.ini file in /etc, and still when I use
phpinfo(); it gives me the usual phpinfo page...


First, make sure to restart Apache after you do anything to php.ini
Secondly, when php.ini is absent, php starts with default options.
So where is the info coming from...another php.ini located somewhere
else on my drive ?
A search revealed naddaso I`m out of ideas right now.


If there are any .htaccess files, they can include php overrides also. 
Check to make sure that "local" and "master" values are what you want 
them to be.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Burhan Khalid
Chris Blake wrote:

OK, so I`ve tried all the suggestions posted, thanks guys...but then I
went and deleted the php.ini file in /etc, and still when I use
phpinfo(); it gives me the usual phpinfo page...
First, make sure to restart Apache after you do anything to php.ini
Secondly, when php.ini is absent, php starts with default options.
So where is the info coming from...another php.ini located somewhere
else on my drive ?
A search revealed naddaso I`m out of ideas right now.
If there are any .htaccess files, they can include php overrides also. 
Check to make sure that "local" and "master" values are what you want 
them to be.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
Start here:

grep -r safe_mode /*

;)

Chris Blake wrote:

On Wed, 2003-10-08 at 15:23, Marek Kilimajer wrote:

Then check your httpd.conf for php_(admin_)?(flag|value)



OK, so I`ve tried all the suggestions posted, thanks guys...but then I
went and deleted the php.ini file in /etc, and still when I use
phpinfo(); it gives me the usual phpinfo page...
So where is the info coming from...another php.ini located somewhere
else on my drive ?
A search revealed naddaso I`m out of ideas right now.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] shell_exec question

2003-10-08 Thread Ford, Mike [LSS]
On 08 October 2003 15:19, Chris Blake contributed these pearls of wisdom:

> On Wed, 2003-10-08 at 15:23, Marek Kilimajer wrote:
>> Then check your httpd.conf for php_(admin_)?(flag|value)
>> 
> 
> OK, so I`ve tried all the suggestions posted, thanks
> guys...but then I went and deleted the php.ini file in /etc,
> and still when I use phpinfo(); it gives me the usual phpinfo
> page... 
> 
> So where is the info coming from...another php.ini located
> somewhere else on my drive ? 

No, these will be PHP's built-in default values (which are the same as the ones in one 
of the php.ini-* included in the PHP distribution -- php.ini-dist, I think, but I 
could be wrong).

The trick is to look at the phpinfo() output for Configuration file (php.ini) path -- 
if it only gives a directory's path (ending in /, without a php.ini filename on the 
end), than that is the path it is looking in, but there is no php.ini file there so 
the built-in defaults are being used.  If it gives a full pathname ending with an 
actual filename, that is the file it is reading.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Chris Blake
On Wed, 2003-10-08 at 15:23, Marek Kilimajer wrote:
> Then check your httpd.conf for php_(admin_)?(flag|value)
> 

OK, so I`ve tried all the suggestions posted, thanks guys...but then I
went and deleted the php.ini file in /etc, and still when I use
phpinfo(); it gives me the usual phpinfo page...

So where is the info coming from...another php.ini located somewhere
else on my drive ?

A search revealed naddaso I`m out of ideas right now.

-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

buzzword, n:
The fly in the ointment of computer literacy.


16:16:41 up 21 days,  7:46,  3 users,  load average: 0.43, 0.20, 0.24

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Chris Blake
On Wed, 2003-10-08 at 15:23, Marek Kilimajer wrote:
> Then check your httpd.conf for php_(admin_)?(flag|value)

I checked it but there is nothing for php whatsoever.

-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Anybody with money to burn will easily find someone to tend the fire.

15:35:56 up 21 days,  7:05,  3 users,  load average: 0.08, 0.08, 0.14

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
Then check your httpd.conf for php_(admin_)?(flag|value)

Chris Blake wrote:

On Wed, 2003-10-08 at 15:02, Marek Kilimajer wrote:

I think that ALL files in other location are parsed, it does not need to 
be named php.ini



I checked in /etc/php/ and it lists the following files :

23_gid.ini
26_imap.ini
27_ldap.ini
34_mysql.ini and
41_readline.ini
All these files contain single entries e.g

extension =readline.so

and so on.

Is there another file I should look for in /etc ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Chris Blake
On Wed, 2003-10-08 at 15:02, Marek Kilimajer wrote:
> I think that ALL files in other location are parsed, it does not need to 
> be named php.ini
> 

I checked in /etc/php/ and it lists the following files :

23_gid.ini
26_imap.ini
27_ldap.ini
34_mysql.ini and
41_readline.ini

All these files contain single entries e.g

extension =readline.so

and so on.

Is there another file I should look for in /etc ?

-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

A person forgives only when they are in the wrong.


15:08:37 up 21 days,  6:38,  3 users,  load average: 0.33, 0.16, 0.14

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
I think that ALL files in other location are parsed, it does not need to 
be named php.ini

Chris Blake wrote:

On Wed, 2003-10-08 at 14:51, Marek Kilimajer wrote:

Did you edit the right php.ini? Check out phpinfo() output for 
"Configuration File (php.ini) Path"



Yep, tried that...it states /etc/php.ini, and lists other location of
/etc/php/, but that directory doesn`t contain a php.ini file
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Chris Blake
On Wed, 2003-10-08 at 14:51, Marek Kilimajer wrote:
> Did you edit the right php.ini? Check out phpinfo() output for 
> "Configuration File (php.ini) Path"
> 

Yep, tried that...it states /etc/php.ini, and lists other location of
/etc/php/, but that directory doesn`t contain a php.ini file

-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Campus sidewalks never exist as the straightest line between two points.
-- M. M. Johnston

14:56:07 up 21 days,  6:26,  3 users,  load average: 0.48, 0.25, 0.21

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
Did you edit the right php.ini? Check out phpinfo() output for 
"Configuration File (php.ini) Path"

Chris Blake wrote:

On Wed, 2003-10-08 at 13:56, David Otton wrote:


However, is there any reason you're not using readdir()?

http://uk.php.net/manual/en/function.readdir.php


I`ve got a whole bunch of other stuff happening using shell_exec, eg
file searches etc
I changed php.ini entry for safemode=on , restarted Apache, but that
didn`t help.opendir() returns the following :
=

Warning: opendir() [function.opendir]: SAFE MODE Restriction in effect.
The script whose uid is 0 is not allowed to access /home owned by uid 0
in /var/www/html/backups.php on line 8
Warning: opendir(/home/chris/PBPCBackup/) [function.opendir]: failed to
open dir: No such file or directory in /var/www/html/backups.php on line
8
=

I got this error as well prior to changing the safe mode parameter...

Still lost, but searching   :(


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] shell_exec question

2003-10-08 Thread Chris Blake
On Wed, 2003-10-08 at 13:56, David Otton wrote:

> However, is there any reason you're not using readdir()?
> 
> http://uk.php.net/manual/en/function.readdir.php

I`ve got a whole bunch of other stuff happening using shell_exec, eg
file searches etc

I changed php.ini entry for safemode=on , restarted Apache, but that
didn`t help.opendir() returns the following :

=

Warning: opendir() [function.opendir]: SAFE MODE Restriction in effect.
The script whose uid is 0 is not allowed to access /home owned by uid 0
in /var/www/html/backups.php on line 8

Warning: opendir(/home/chris/PBPCBackup/) [function.opendir]: failed to
open dir: No such file or directory in /var/www/html/backups.php on line
8

=

I got this error as well prior to changing the safe mode parameter...

Still lost, but searching   :(


-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

Women want their men to be cops.  They want you to punish them and tell
them what the limits are.  The only thing that women hate worse from a
man
than being slapped is when you get on your knees and say you're sorry.
-- Mort Sahl


14:40:40 up 21 days,  6:10,  3 users,  load average: 0.32, 0.14, 0.25

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread David Otton
On 08 Oct 2003 13:25:51 +0200, you wrote:

>I`m using a shell_exec to get a list of files from a specified
>directory.
>
>When I run it locally on my machine i works. When I run it on the other
>machine I get

What Marek said.

However, is there any reason you're not using readdir()?

http://uk.php.net/manual/en/function.readdir.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question

2003-10-08 Thread Marek Kilimajer
safe mode is on, turn it off and restart webserver. Then you can check 
directory permissions.

Chris Blake wrote:

Greetings learned PHP(eople);

I`m using a shell_exec to get a list of files from a specified
directory.
When I run it locally on my machine i works. When I run it on the other
machine I get
=
Warning: shell_exec() [function.shell-exec]: Cannot execute using
backquotes in Safe Mode in /var/www/html/search.php on line 9
=
In /etc/php.ini Safe Mode is offI read some postings in the archives
and on the advice given checked that the owner of the script has the
relevant permissions on the directory/files trying to be accessed, and
they are the same i.e. root
Any ideas ?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] shell_exec question

2003-10-08 Thread Chris Blake
Greetings learned PHP(eople);

I`m using a shell_exec to get a list of files from a specified
directory.

When I run it locally on my machine i works. When I run it on the other
machine I get

=
Warning: shell_exec() [function.shell-exec]: Cannot execute using
backquotes in Safe Mode in /var/www/html/search.php on line 9
=

In /etc/php.ini Safe Mode is offI read some postings in the archives
and on the advice given checked that the owner of the script has the
relevant permissions on the directory/files trying to be accessed, and
they are the same i.e. root

Any ideas ?


-- 
Chris Blake
Support Consultant
Office : (011) 782-0840
Fax: (011) 782-0841
Mobile : 083 985 0379
Website: http://www.pbpc.co.za

What does education often do?  It makes a straight cut ditch of a
free meandering brook.
-- Henry David Thoreau


13:10:21 up 21 days,  4:40,  3 users,  load average: 0.48, 0.33, 0.28

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] shell_exec

2003-08-14 Thread Rodney Green
Hello. I've been attempting to write a script that will run a shell script
using the shell_exec function and haven't had any success with getting it to
run in the browser. My web server runs as the user 'apache.' I'm able to run
the script successfully from the command line as root but when I run it in
the browser the shell script executes but fails. Is there a way to trace
what is happening when it is being run from the browser to figure out what
the problem is? Any suggestiosn? I've set the permissions of the script to
be executable for anyone.

Thanks,
Rod


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec

2003-08-14 Thread Juan Nin
From: "Rodney Green" <[EMAIL PROTECTED]>

> Hello. I've been attempting to write a script that will run a shell script
> using the shell_exec function and haven't had any success with getting it
to
> run in the browser. My web server runs as the user 'apache.' I'm able to
run
> the script successfully from the command line as root but when I run it in
> the browser the shell script executes but fails. Is there a way to trace
> what is happening when it is being run from the browser to figure out what
> the problem is? Any suggestiosn? I've set the permissions of the script to
> be executable for anyone.

check for errors at /var/log/httpd/error_log or at /var/log/messages

regards,

Juan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec

2003-08-08 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> 
> 
> 
> > Shell side:
> > - must be readable and executable by user (apache or perhaps everyone)
> > - suid bit work only for programs, not scripts I think
> > - shell can only execute cmds for which it's effective user has
> > sufficient permissions
> >
> > Try this (as root on webserver), if you can login as apache.
> > If you can't login as apache, log as a normal user (not root)
> > # su - apache
> > $ cd /path/to/script
> > $ ./myscript.sh
> > You will probably see errors here.
> 
> 
> As Juan suggested I checked /var/log/messages. The shell script I'm trying
> to run is a script that restarts our web content filter. In the script it
> removes the pid file so it will be recreated when the application is started
> again. The error I'm getting in the message log is "dansguardian: Error
> creating/opening pid file." Any ideas on what to do?
> 
> Thanks for your help,
> Rod
> 
> 
Check whether the user that the webserver runs as has appropriate  
permissions in the relevant directory?

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec

2003-08-08 Thread Rodney Green



> Shell side:
> - must be readable and executable by user (apache or perhaps everyone)
> - suid bit work only for programs, not scripts I think
> - shell can only execute cmds for which it's effective user has
> sufficient permissions
>
> Try this (as root on webserver), if you can login as apache.
> If you can't login as apache, log as a normal user (not root)
> # su - apache
> $ cd /path/to/script
> $ ./myscript.sh
> You will probably see errors here.


As Juan suggested I checked /var/log/messages. The shell script I'm trying
to run is a script that restarts our web content filter. In the script it
removes the pid file so it will be recreated when the application is started
again. The error I'm getting in the message log is "dansguardian: Error
creating/opening pid file." Any ideas on what to do?

Thanks for your help,
Rod


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec

2003-08-06 Thread Christophe Chisogne
Rodney Green wrote:
> My web server runs as the user 'apache.' (...)
the script successfully from the command line as root but when I run it in
the browser the shell script executes but fails.
> (...)
I've set the permissions of the script to be executable for anyone.
Shell side:
- must be readable and executable by user (apache or perhaps everyone)
- suid bit work only for programs, not scripts I think
- shell can only execute cmds for which it's effective user has 
sufficient permissions

Try this (as root on webserver), if you can login as apache.
If you can't login as apache, log as a normal user (not root)
# su - apache
$ cd /path/to/script
$ ./myscript.sh
You will probably see errors here.
If not, it probably is a safemode restriction. See
http://www.php.net/manual/en/features.safe-mode.php#ini.safe-mode
and set the safe_mode_* variables in php.ini or in a .htaccess,
in particular safe_mode_exec_dir ...
Hope it helps

--
Christophe Chisogne
http://www.publicityweb.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Shell_exec() [ or what else? ] to kill root-started FTPdaemon

2003-07-22 Thread Marek Kilimajer
Try sudo (man sudo)

Pietuka Krustiņš wrote:
Hello.

I am trying to restart my FTP daemon by killing it and then starting it using 
the shell_exec() function:

shell_exec('kill '.$pid );
Shell_exec does nothing by this - when i do ps -ef later, i see the daemon 
with the same pid still running.

But it did return the correct pid when i ran:

$pid = shell_exec('cat /var/myftpd.pid');

I think it cannot kill the process because it has no rights. What should be 
done to give php scripts rights to rule?

I run apache 1.3.27, php 4.3.2 on suse 8.1; Apache starts as root, switches to 
nobody...

!!! The FTP daemon cannot be started by any other user but root so idea to 
start and kill the daemon by some special apache user does not work :(

Any ideas? Why can't my dear friend PHP rule???




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Shell_exec() [ or what else? ] to kill root-started FTP daemon

2003-07-22 Thread Pietuka Krustiņš
Hello.

I am trying to restart my FTP daemon by killing it and then starting it using 
the shell_exec() function:

shell_exec('kill '.$pid );
Shell_exec does nothing by this - when i do ps -ef later, i see the daemon 
with the same pid still running.

But it did return the correct pid when i ran:

$pid = shell_exec('cat /var/myftpd.pid');

I think it cannot kill the process because it has no rights. What should be 
done to give php scripts rights to rule?

I run apache 1.3.27, php 4.3.2 on suse 8.1; Apache starts as root, switches to 
nobody...

!!! The FTP daemon cannot be started by any other user but root so idea to 
start and kill the daemon by some special apache user does not work :(

Any ideas? Why can't my dear friend PHP rule???


-- 
Best regards,
Pietuka




-- Tavs bezmaksas pasts Inbox.lv



---
Šīs ziņojums nesatur vīrusus.
Garantē Kaspersky Anti-Virus.
www.antivirus.lv


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec question....

2003-03-28 Thread David T-G
Kalin --

Please don't hijack threads.  This question has nothing to do with your
"last questions" regarding email address regular expressions.  For that
matter, *that* had nothing to do with php and perl.

Mail and news messages have many headers, some of which serve to connect
messages together.  You can even change the Subject: as the discussion
evolves or forks and the messages will all still be properly related to
the right parents and children.  This is a good thing, even though
Microsoft Outlook really doesn't support it too well at all and many
users of it have no threading or sorting capabilities.

When starting a new topic, or "thread", please start a fresh message.
Not only is there no chance of forgetting to change the subject but the
message also does not appear glued onto another message where it really
doesn't belong.

...and then Kalin Mintchev said...
% 
% hello list,

Hi!


% 
% what has to happened so this actually works:
% 
% $mstrng = shell_exec("/usr/sbin/zip 0041_27032003223711.zip
% 0041_27032003223711");

Are you running under safe mode, which turns off shell execs?  Can you
call anything via shell_exec?  Have you tried using system() instead?


% 
% if php is compiled as a module with apache is the apache owner the one
% that has to have writing permissions? if so - it does..

OK; that's a good start.  We need more details, though.  Tell us what
you've done and what does or doesn't happen, including any error messages
on the web page or in the apache log.


% 
% any help appreciated...
% 
% thank you


HTH & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] shell_exec question....

2003-03-27 Thread Kalin Mintchev

hello list,

what has to happened so this actually works:

$mstrng = shell_exec("/usr/sbin/zip 0041_27032003223711.zip
0041_27032003223711");

if php is compiled as a module with apache is the apache owner the one
that has to have writing permissions? if so - it does..

any help appreciated...

thank you


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec problem

2002-11-15 Thread Jason Wong
On Friday 15 November 2002 03:02, Coert Metz wrote:
> Hi everybody
>
> I have some few problems with the shell_exec command.
> I want to send a fax with hylafax using the sendfax program in linux.
> When I try to do shell_exec ("sendfax -n -d faxnumber faxfile") it will

I have a little app which allows someone to enter a number and upload a PDF 
file which gets faxed using sendfax. Works fine here. I'm basically doing the 
same as you are:

  shell_exec("sendfax $OPTIONS -d $DESTINATION $FILE");

> not work I can see in my httpd file that linux only gets the command
> 'sendfax' and not the parameters '-n -d .'.

What httpd file? You mean the log? What exactly do you see? Copy-paste the 
line(s).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
MMM-MM!!  So THIS is BIO-NEBULATION! 
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec problem

2002-11-14 Thread Coert Metz
Hi everybody

I have some few problems with the shell_exec command.
I want to send a fax with hylafax using the sendfax program in linux.
When I try to do shell_exec ("sendfax -n -d faxnumber faxfile") it will 
not work I can see in my httpd file that linux only gets the command 
'sendfax' and not the parameters '-n -d .'.

Can anybody help me?

Thanks in advance

Coert Metz


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec('cp...

2002-10-08 Thread Marco Tabini

Have you tried redirecting stderr to a file?

On Tue, 2002-10-08 at 11:50, Alec Solway wrote:
> I'm having problems running cp from shel_exec(). Nothing is returned, but 
> the copy is unsuccessful. The same call works as user nobody from the 
> actual shell. Any ideas?
> 
> -Alec
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec('cp...

2002-10-08 Thread Alec Solway

I'm having problems running cp from shel_exec(). Nothing is returned, but 
the copy is unsuccessful. The same call works as user nobody from the 
actual shell. Any ideas?

-Alec


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec "root" question

2002-08-08 Thread Hendrik Daldrup

Hi,

i wrote a script, which runs

echo shell_exec("exim -bp");

so it simply gives me the current mail queue.
However, it only works when called by user "root", because exim won't 
let "group" or "others" execute it.
So, i cannot use it with apache, because it runs as "nobody".
Well, i saw scripts that can do so, but i have no clue how it is 
possible for them.
Does anyone have an idea?
I thought about adding a cron-job and let it update a file every 5 
minutes with the current mail queue, but that will cause unnecesary load 
and it won't be up2date.

So, any ideas are welcome,

Thanks,

Duncan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] shell_exec() or passthru()

2002-03-23 Thread Andrew Lopucki

And by redirect I mean to /dev/null possibly if you don't want to capture 
output.

On Saturday 23 March 2002 03:52 pm, Douglas wrote:
> Hi,
>
> I have a bash script I need to run.
> I have tried all the various program execution commands.
>
> My script never completes. It only get 1/4 of the way through.
> I have tried running the script in the background.
>
> Any ideas?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] shell_exec() or passthru()

2002-03-23 Thread Andrew Lopucki

You may need to redirect output (both stderr and stdout) atleast that helped 
me with a similar problem.  My system is Linux.


On Saturday 23 March 2002 11:06 pm, Douglas wrote:
> Hi,
>
> I have a bash script I need to run.
> I have tried all the various program execution commands.
>
> My script never completes. It only get 1/4 of the way through.
> I have tried running the script in the background.
>
> Any ideas?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec() or passthru()

2002-03-23 Thread Douglas

Hi,

I have a bash script I need to run.
I have tried all the various program execution commands.

My script never completes. It only get 1/4 of the way through.
I have tried running the script in the background.

Any ideas?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec() or passthru()

2002-03-23 Thread Douglas

Hi,

I have a bash script I need to run.
I have tried all the various program execution commands.

My script never completes. It only get 1/4 of the way through.
I have tried running the script in the background.

Any ideas?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] shell_exec()

2002-03-15 Thread Jason Wong

On Saturday 16 March 2002 06:21, Carlos Fernando Scheidecker Antunes wrote:
> Hello all,
>
> Does anyone know if shell_exec waits to have whatever it was passed to
> be executed before returning to the script?
>
> I am asking that because I need to write a script to compact files to a
> zip and then have it e-mailed to a predefined address.
>
> The files it will compact might have a considerable size and since this
> script will be triggered by a web page I wonder if shell_exec would be
> executed as a separate thread or if it will be the same one.
>
> For me, the ideal thing was to have it wait for the command to be over.

It waits.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
There's so much to say but your eyes keep interrupting me.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] shell_exec()

2002-03-15 Thread Carlos Fernando Scheidecker Antunes

Hello all,

Does anyone know if shell_exec waits to have whatever it was passed to 
be executed before returning to the script?

I am asking that because I need to write a script to compact files to a 
zip and then have it e-mailed to a predefined address.

The files it will compact might have a considerable size and since this 
script will be triggered by a web page I wonder if shell_exec would be 
executed as a separate thread or if it will be the same one.

For me, the ideal thing was to have it wait for the command to be over.

Any suggestions?

Thank you,

Carlos Fernando.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php