haloangelboy Posted April 8, 2009 Share Posted April 8, 2009 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.. Link to comment https://forums.phpfreaks.com/topic/153109-what-could-cause-sed-not-to-work-through-exec/ Share on other sites More sharing options...
Daniel0 Posted April 8, 2009 Share Posted April 8, 2009 Try to use absolute paths to the binary and to the file. Link to comment https://forums.phpfreaks.com/topic/153109-what-could-cause-sed-not-to-work-through-exec/#findComment-804269 Share on other sites More sharing options...
haloangelboy Posted April 8, 2009 Author Share Posted April 8, 2009 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. Link to comment https://forums.phpfreaks.com/topic/153109-what-could-cause-sed-not-to-work-through-exec/#findComment-804812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.