3

for first mention, this question is extension to my previous question here. And my goal is still same. 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 (virDir) on directory (tarDir) on drive 2 when all files i need to acces are stored.

When i run pdftotext.exe by myself everything work like a charm, on drive 1 output file with pdfcontent is created and everyone lives happy till dead. But when im trying to execute PHP script, stored in drive 1 in virDir, which runs pdftotext.exe via exec command, it returns 1 and no file is created.

In my last question i figured out that it will be probably permission issue, but im bit confused how to set them. IIS7 have some internal users like IUSR and IIS_IUSRS and when i call get_current_user(); in php, its set to testUser.

So which permissions i need to set to both dirs(virDir and tarDir) so server can acces them?

I tried that testUser have set Modify, Read a Execute, List folder contents, Read, Write permissions on tarDir (drive 2), and IUSR, testUser and II_IUSRS have Read a Execute, List folder contents, Read, Write permissions on tarDir (drive 1).

When im trying to acces "normal" files, like txt, pptx, etc i can read them without problem (im using php library for it), but when i try to use pdftotext.exe it fails.

Can someone see what im doing wrong?

EDIT: So i made some other testing, and when i run this comand (im currious who is running command line)

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>";

Runned on drive 1 it shows that command line is runned by testUser, but when i run it in drive 1 virDir, it returns 1. So probably issue with permissions about executing commands in shell... i will apreaciaty any hint...

Community
  • 1
  • 1
Luboš Suk
  • 1,526
  • 14
  • 38

2 Answers2

0

So it seems issue wasnt in permissions (i set permisions for both directories to testUser, and still getting same error), but when i moved pdftotext.exe to virtual directory, and now it looks like it working. But im curious why...

Luboš Suk
  • 1,526
  • 14
  • 38
0

Use the permission as "Everyone", so that directory can be accessed without any issues.

Steps:

  1. right click on directory folder and select properties
  2. Under Security tab click the Edit button
  3. Now click Add button
  4. Specify "Everyone" in the field: Enter the object name to select and click check names to recognize it.
  5. Give Full Control and Apply

Recently i faced the same issue, the above step solved it

Pranesh Janarthanan
  • 1,134
  • 17
  • 26