[PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
I have two programs on two servers, and they both have similar problems. In each one, I use 'exec' to call a helper program. In one case, it is ecasound, which I use to resample an mp3. In the other, it is convert, which creates a thumbnail of a very large image the user has uploaded. In

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: I have two programs on two servers, and they both have similar problems. In each one, I use 'exec' to call a helper program. In one case, it is ecasound, which I use to resample an mp3. In the other, it is convert, which creates a thumbnail of a very large image the

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: I have two programs on two servers, and they both have similar problems. In each one, I use 'exec' to call a helper program. In one case, it is ecasound, which I use to resample an mp3. In the other, it is convert, which creates a thumbnail of a very large image the

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
Please reply to the list. [EMAIL PROTECTED] wrote: No, all of these things your are bringing up would cause the programs to NEVER work, not work some of the time or when the data they are processing is small. Depends on the install. My cli uses a different php.ini than the web one. Did you

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
I don't want to crowd the list up with dead ends, so I was trying to respond only to you. I'm not calling a php program from exec, I'm calling ecasound and convert. For example, in the php code: exec(convert $internalpath/$filename -resize {$thumbWidth}x{$thumbHeight}

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: I don't want to crowd the list up with dead ends, so I was trying to respond only to you. snip You'll get more chances at finding the solution to this with the list's eyes on it rather than just myself. Plus, it provides an archive of the problem and the (if we find

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
If the web server didn't have permission to execute the app, it would NEVER execute the app, not execute it some of the time. In fact, it ALWAYS executes the app, it just doesn't always allow it to finish. I log all attempts to run these apps in order to debug, so I know that the command as

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: If the web server didn't have permission to execute the app, it would NEVER execute the app, not execute it some of the time. In fact, it ALWAYS executes the app, it just doesn't always allow it to finish. I log all attempts to run these apps in order to debug, so I

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
the logs say things like: /kunden/homepages/12/d117065027/htdocs/software/ImageMagick-6.2.3/utilities/convert ib_images/Other_Spices_Basic_004.jpg -resize 180x120 ib_images/Other_Spices_Basic_004_thumb.jpg this is a command I'm trying to get php to run. I then cut and paste it to the command

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: the logs say things like: /kunden/homepages/12/d117065027/htdocs/software/ImageMagick-6.2.3/utilities/convert ib_images/Other_Spices_Basic_004.jpg -resize 180x120 ib_images/Other_Spices_Basic_004_thumb.jpg this is a command I'm trying to get php to run. I then cut

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
timeout isn't being used on either of these machines, and as far as I read it, the timeout directive would make the web server fail, producing an apache error or some strange behaviour on the client end. Neither of these happens, the php script completes normally, but the exec command (and

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: timeout isn't being used on either of these machines, and as far as I read it, the timeout directive would make the web server fail, producing an apache error or some strange behaviour on the client end. Neither of How is timeout _not_ being used? It's a core

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
as I said, the default timout is 300 seconds, a lot longer than my program takes to run, and I am pretty certain that if timeout were triggered, I'd see it in the client. Yeah, I'm using a browser on the php page, and everything seems to function fine from the browser to the server, it's

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: as I said, the default timout is 300 seconds, a lot longer than my program takes to run, and I am pretty certain that if timeout were triggered, I'd see it in the client. Yeah, I'm using a browser on the php page, and everything seems to function fine from the

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
convert doesn't produce any output regardless of whether it works or not. Ecasound produces output when it works, but when it doesn't, it produces no output. Using php tricks to capture standard error also produces no output. On Wed, 21 Sep 2005, John Nichel wrote: [EMAIL PROTECTED]

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread John Nichel
[EMAIL PROTECTED] wrote: convert doesn't produce any output regardless of whether it works or not. Ecasound produces output when it works, but when it doesn't, it produces no output. Using php tricks to capture standard error also produces no output. Hopefully somebody else on the list can

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
You're telling me. That's why I think php or apache kills it. On Wed, 21 Sep 2005, John Nichel wrote: [EMAIL PROTECTED] wrote: convert doesn't produce any output regardless of whether it works or not. Ecasound produces output when it works, but when it doesn't, it produces no output. Using

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread Rasmus Lerdorf
[EMAIL PROTECTED] wrote: You're telling me. That's why I think php or apache kills it. I didn't really follow this, but typically you can debug exec problems from the command line by switching to the web server user id and running the exact same command. -Rasmus -- PHP General Mailing List

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
Yes, but that's been done. Since these are shared servers, on one I am logged in as the user the web server is running as, on the other I can't su to nobody, but were there permissions errors, I would have been able to capture them. If permissions caused this, it would fail every time, since

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread rouvas
I am assuming that you get hold of the file through uploading it, correct? So, when it fails maybe another upload (i.e. script invocation) is happening and the previous file gets lost/corrupted/whatever. Try to move the file to another dir (maybe /tmp) with a random name and see what happens.

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
php places uploaded files in the /tmp directory with a unique name, and when I copy them to my directory, I also guarantee a unique name for them. I have verified that this is all working. I've patched this with a cron job that runs every minute, but it really should happen in php, so that

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread adriano ghezzi
did you tried to run the script from the shell as www-data user ? (if not su www-data) an then run the script may be something regarding permission hth 2005/9/21, John Nichel [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: I have two programs on two servers, and they both have similar problems.

Re: [PHP] exec command fails in php, works in the command line

2005-09-21 Thread ernst
yeah, if you look at the thread you will see that I've already done this. On Wed, 21 Sep 2005, adriano ghezzi wrote: did you tried to run the script from the shell as www-data user ? (if not su www-data) an then run the script may be something regarding permission hth 2005/9/21, John Nichel

Re: [PHP] exec command

2005-04-07 Thread Philip Hallstrom
You might find that get_current_user() is easier... http://www.php.net/manual/en/function.get-current-user.php On Wed, 6 Apr 2005, cragland wrote: when running a simple php script, below, with exec, I recieve: sh: /whoami: No such file or directory ?php // outputs the username that owns the

[PHP] exec command

2005-04-06 Thread cragland
when running a simple php script, below, with exec, I recieve: sh: /whoami: No such file or directory ?php // outputs the username that owns the running php/httpd process // (on a system with the whoami executable in the path) echo exec('whoami'); ? Thanks very much, cole mailto:[EMAIL

RE: [PHP] exec command

2005-04-06 Thread Mike
when running a simple php script, below, with exec, I recieve: sh: /whoami: No such file or directory ?php // outputs the username that owns the running php/httpd process // (on a system with the whoami executable in the path) echo exec('whoami'); ? You may want to try using the full

[PHP] Exec() command on UNIX

2004-12-01 Thread Sitthipong Thuetham
Dear PHP support, I have a question on an exec() command, if I would like to switch user right on Unix server, what command should I use? example: on the UNIX shell will be like below $su root Password:'password' but when I tried running exec() command on PHP, I couldn't do that exec(su root);

Re: [PHP] Exec() command on UNIX

2004-12-01 Thread Greg Donald
On Wed, 1 Dec 2004 16:18:01 +0700, Sitthipong Thuetham [EMAIL PROTECTED] wrote: Dear PHP support, I have a question on an exec() command, if I would like to switch user right on Unix server, what command should I use? example: on the UNIX shell will be like below $su root

Re: [PHP] Exec() command on UNIX

2004-12-01 Thread Richard Lynch
Sitthipong Thuetham wrote: I have a question on an exec() command, if I would like to switch user right on Unix server, what command should I use? example: on the UNIX shell will be like below $su root Password:'password' but when I tried running exec() command on PHP, I couldn't do that

[PHP] exec command

2003-10-01 Thread nabil
hi all; I want to execute #useradd -d /home/all -g wahtever -s /bin/bash newuser how can I do it ... I used exec and shell_exec and system I tried all the following but with no hope exec('useradd -d /home/all -g wahtever -s /bin/bash newuser') or die ('not done'); exec('/usr/sbin/useradd -d

Re: [PHP] exec command

2003-10-01 Thread Ray Hunter
I want to execute #useradd -d /home/all -g wahtever -s /bin/bash newuser You have to be root to add a user to the system...and just a heads up...you might want to rethink doing this from apache or php. The security implications alone make me cringe. -- Ray -- PHP General Mailing List

RE: [PHP] exec command

2003-10-01 Thread Javier Tacon
From CLI or Web? You must have in mind that useradd only can be executed by root user. -Mensaje original- De: nabil [mailto:[EMAIL PROTECTED] Enviado el: miƩrcoles, 01 de octubre de 2003 16:05 Para: [EMAIL PROTECTED] Asunto: [PHP] exec command Importancia: Baja hi all; I want

RE: [PHP] exec command

2003-10-01 Thread Javier Tacon
: [EMAIL PROTECTED] Asunto: Re: [PHP] exec command Importancia: Baja I want to execute #useradd -d /home/all -g wahtever -s /bin/bash newuser You have to be root to add a user to the system...and just a heads up...you might want to rethink doing this from apache or php. The security implications

Re: [PHP] exec command

2003-10-01 Thread Marek Kilimajer
You can use sudo (man sudo), but keep in mind security!!! nabil wrote: hi all; I want to execute #useradd -d /home/all -g wahtever -s /bin/bash newuser how can I do it ... I used exec and shell_exec and system I tried all the following but with no hope exec('useradd -d /home/all -g wahtever -s

Re: [PHP] exec command

2003-10-01 Thread Nabil
so when i use php exec to do it , am i using apache user (nobody) or am i using php user , is there a php user ? so what can i do ? i want to execute #useradd -d /home/all -g wahtever -s /bin/false newuser as i want to create only pop user on the system when my user make regestration.. to give

Re: [PHP] exec command

2003-10-01 Thread Dennis Sterzenbach
Nabil [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] so when i use php exec to do it , am i using apache user (nobody) or am i using php user , is there a php user ? so what can i do ? i want to execute #useradd -d /home/all -g wahtever -s /bin/false newuser as i want to create

[PHP] Exec command not working through php

2003-07-15 Thread Mike Morton
I have the following exec command in php: exec(/bin/sed -f $GLOBALS[TMP_MAIL_DIR].cmdfile $GLOBALS[TMP_MAIL_DIR].$mailid $GLOBALS[TMP_MAIL_DIR].$mailid.tmp,$results); Which does a search and replace using the sed command file: s/#39;/'/g s/quot;//g Now, executed command line, this works

Re: [PHP] Exec command not working through php

2003-07-15 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Tue, 15 Jul 2003 at 21:30, lines prefixed by '' were originally written by you. I have the following exec command in php: exec(/bin/sed -f $GLOBALS[TMP_MAIL_DIR].cmdfile $GLOBALS[TMP_MAIL_DIR].$mailid

Re: [PHP] Exec command not working through php

2003-07-15 Thread Mike Morton
if I print out the exec line with the dynamically generated paths, etc, then execute that through the terminal, no problem. From the first email meaning that I did just like you suggested already and it works in the terminal and contains exactly what I expect it to. But thanks :) On 7/15/03

Re: [PHP] Exec command not working through php

2003-07-15 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Tue, 15 Jul 2003 at 23:17, lines prefixed by '' were originally written by you. if I print out the exec line with the dynamically generated paths, etc, then execute that through the terminal, no problem. From the first email meaning that

Re: [PHP] Exec command not working through php

2003-07-15 Thread Mike Morton
David: Permissions were the first guess - I chmoded 777 everything - still no go. On the server, there should be a second file created identical to the first with the results of the sed find and replace in it - the only thing that is created is a blank file. So, it is not permissions, nothing

[PHP] Exec ( ) command

2003-03-17 Thread manju visu
Hi everyone, If possible reply me. I have one problem. I'm trying to execute exec() command to generate stats by using the exec() function, it does not generate an error but it also does not run the command, and the value of $result thats returned from exec() is 11. Below is my PHP coding.

Re: [PHP] Exec ( ) command

2003-03-17 Thread Chris Hewitt
manju visu wrote: Hi everyone, If possible reply me. I have one problem. I'm trying to execute exec() command to generate stats by using the exec() function, it does not generate an error but it also does not run the command, and the value of $result thats returned from exec() is 11. Below

[PHP] Exec command problems

2002-03-30 Thread Georgie Casey
when i try to execute a program, PHP just stalls there for ages, my page doesnt load or anything. the program is a dos pogram, i pass variables thru d command line and when the program runs it just returns 1 line of output and stops. WHATS D PROBLEM? btw, i first get PHP to write a text file and

[PHP] Re: using php exec command

2001-11-21 Thread Richard Lynch
Mark Lo wrote: I would like to know how to use the exec command to assign a new system users. I have sent out this questions so many times, but doesn't get any reply. Does It means this is ridiculous to assign a new system user using PHP EXEC command. Pretty much, yeah. It's

[PHP] using php exec command

2001-11-20 Thread Mark Lo
Hi, I would like to know how to use the exec command to assign a new system users. I have sent out this questions so many times, but doesn't get any reply. Does It means this is ridiculous to assign a new system user using PHP EXEC command. Thank you for your attentions, Mark Lo

[PHP] exec command help

2001-05-22 Thread Nashirak Bosk
I am trying to run a something everytime a certain page is loaded. I am using PHP4 and am running Debian Linux. I am trying to run this command with exec: exec(/usr/sbin/postalias hash:aliases, $results); In case you are curious this turns a file called aliases into a hashed aliases file

Re: [PHP] exec command help

2001-05-22 Thread Chris Lee
what is the output of $results ? print_r($results); try another command, ie. exec(echo hello world, $results); exec(echo hello world /tmp/test.txt, $results); does that work? does that file aliases.db permissions set as world writeable, or the user.group set to nobody.nobody (ie. whatever