0

I have IIS7 server (where i running some PHP) on network drive (drive 1), when im trying acces another network drive (drive 2), where are need to acces PDF files with pdftotext.exe. On drive 1 i also have a virtual/link directory which points on target directory on drive 2 (which i need to access).

There is IUSR, IIS_IUSRS, and my user testUser under who is everything running.

When i try acces files in target directory via PHP its okay, i can read them. But when i try to use exec and pdftotext.exe i get returnvalue 1.

I checked under which user is PHP and exec running, and when i execute this script

echo "user <br>";
echo get_current_user();

echo "<br> who am i in command line? <br>";
$out = array();
exec('cmd /c whoami 2>&1',$out,$exitcode);
echo "<br />EXEC: ( exitcode : $exitcode )";
echo "<hr /><pre>";
print_r($out);
echo "</pre>";

in drive 1 (out of virtual directory) i have information that both things are under testUser. But when i try it in virtual directory, php is runned by testUser, but exec returns 1.

So my question is how i need to set permissions, so i can use exec on remote directories? (testUser have all permision on drive 1, even on target directory on drive 2)

Luboš Suk
  • 61
  • 4
  • are you using symlinks? traversing symlinks on remote drives is not enabled by default - this would require client configuration to traverse the link. – Daniel Nachtrub Feb 24 '16 at 08:21
  • @Daniel Nachtrub im sorry, im not sure if im using symlink, but probably not. Is it even possible to acces shared network drive without symlink? – Luboš Suk Feb 24 '16 at 08:41
  • I'm not sure if i understand the question completely. It seems that you're accessing drive 2 via a link/virtual directory. Can you try accessing it directly and see if the process works? – Daniel Nachtrub Feb 24 '16 at 08:55
  • Yes, im tring it from link/virtual directory, even from normal directory. Both have same result described in question as result 1 – Luboš Suk Feb 24 '16 at 09:00

1 Answers1

1

So it seems, the issue wasn't with permissions (I have set permisions for both directories to testUser, and still getting same error). But then I moved pdftotext.exe to virtual directory, and now it seems to be working. But I'm curious to know why.

Diamond
  • 9,001
  • 3
  • 24
  • 38
Luboš Suk
  • 61
  • 4
  • Do you invoke `pdftotext.exe` using the full executable path in your PHP script? If you supply only the filename to the `exec ()` call, you may have to set `%PATH%` variable accordingly. – Anderson Medeiros Gomes Feb 27 '16 at 00:26
  • yes i set full path, but my issue was that i need to run it from virtual directory to target current path. When i try it to run it with target on server, it works okay – Luboš Suk Feb 27 '16 at 18:22