Skip to content

Instantly share code, notes, and snippets.

@enderandpeter
Last active December 30, 2015 03:49
Show Gist options
  • Save enderandpeter/7772048 to your computer and use it in GitHub Desktop.
Save enderandpeter/7772048 to your computer and use it in GitHub Desktop.
Show the php process owner and the permissions for the current directory. Then try to write a file with file_put_contents.
<?php
$processUser = posix_getpwuid(posix_geteuid());
print 'Process owner: ' . '<b style="color:blue">' . $processUser['name'] . '</b>';
echo "<br /> This directory's permisions: <i>" . exec('ls -ld') . '</i><br />';
echo file_put_contents('test.txt', 'hey there') . ' bytes written.';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment