executing commands with pipe operator in safe mode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrhelton
Forum Newbie
Posts: 3
Joined: Thu Jul 10, 2003 9:24 pm

executing commands with pipe operator in safe mode

Post by mrhelton »

hi i can't seem to get php 4.2.2 to execute commands with the pipe operator in safe mode. i am issuing this command

passthru("jpegtopnm picture.jpg | pnmscale .5 | pnmtojpeg >picture_small.jpg");

i can't seem to get php to pipe the output of one command to the other.

also, the > doesn't work...for instance

passthru("jpegtopnm picture.jpg > picture.pnm");

however,

passthru("jpegtopnm picture.jpg");

does write the pnm binary text to the screen.

someone please help me out.

i also have jpegtopnm, pnmtojpeg, and pnmscale in my safe mode exec dir.

helton
mrhelton
Forum Newbie
Posts: 3
Joined: Thu Jul 10, 2003 9:24 pm

Post by mrhelton »

? :(
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

try system() or shell_exec()
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

What error messages are you recieving ?

Are those apps/binaries installed on your server/machine ? Are you able to run those commands from the command line ?

Regards,
Jabol
Forum Newbie
Posts: 4
Joined: Fri Jul 11, 2003 7:06 am

Post by Jabol »

If you're using safe mode you cannot use any commands, not only the pipe ones.
mrhelton
Forum Newbie
Posts: 3
Joined: Thu Jul 10, 2003 9:24 pm

Post by mrhelton »

yes i am able to run these commands from the command line.

i'm not receiving any error messages, i'm just not getting a response.

in order to use redirection operators do you need to have a shell running? when i run 'ps' from a php script it shows that there are no processes running. (i put 'ps' in my safe mode exec dir)

helton
Post Reply