Jump to content

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.