Skip to main content
3 of 5
added 268 characters in body
exussum
  • 4.2k
  • 5
  • 21
  • 21

File permissions

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

exussum
  • 4.2k
  • 5
  • 21
  • 21