Jump to content

What could cause sed not to work through exec?


haloangelboy

Recommended Posts

ok I have been banging my head against this, though I'd ask the gurus..

 

I have some code that essentially is

<?php

$result=exec("sed -i -e '/aaaaa/d' file.txt");

?>

however, the file.txt does not have the expected changes (delete the line containing "aaaaa") after running. In fact the file looks to not be changed at all. This sed command creates the desired changes when executed on the command line however. The file has 777 perms. the PHP info says safemode is off.

 

I have tried system(command), exec(), shellexec() and passthru().. all appear to not run the sed command.

They all work when I run "pwd" however.

 

what could be causing sed to not work?

 

 

ps- its PHP Version 5.2.6 if it matters..

 

 

Try to use absolute paths to the binary and to the file.

 

Yeah i've tried that, even when i copied the binary into the working directory of the php file. it's like somehow sed is not allowed to run?

 

I've messaged the techsupport for our site admins, maybe they will have an answer.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.