Skip to content

Instantly share code, notes, and snippets.

@jpauli
Created August 2, 2012 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpauli/3236041 to your computer and use it in GitHub Desktop.
Save jpauli/3236041 to your computer and use it in GitHub Desktop.
Save your I/Os, dont use open_basedir
$> strace php -r '@unlink("foo.bar");' 2>&1|grep 'foo.bar'
execve("/usr/bin/php", ["php", "-r", "@unlink(\"foo.bar\");"], [/* 17 vars */]) = 0
unlink("foo.bar") = -1 ENOENT (No such file or directory)
$> strace php -d open_basedir="./" -r '@unlink("foo.bar");' 2>&1|grep 'foo.bar'
execve("/usr/bin/php", ["php", "-d", "open_basedir=./", "-r", "@unlink(\"foo.bar\");"], [/* 17 vars */]) = 0
lstat("/home/tyrael/foo.bar", 0x7fff1f569b80) = -1 ENOENT (No such file or directory)
lstat("/home/tyrael/foo.bar", 0x7fff1f569b90) = -1 ENOENT (No such file or directory)
readlink("/home/tyrael/foo.bar", 0x7fff1f56fd30, 4095) = -1 ENOENT (No such file or directory)
unlink("foo.bar") = -1 ENOENT (No such file or directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment