0

I am calling python script script.py through php script index.php by following command:

$tmp = exec("python script.py xyz");

Now, in python script script.py, I am trying to change the directory, which is symlink of folder:

try:
    os.chdir('softlink')
except:
    var = sys.exc_info()
    print var

Below error is coming while executing

<type 'exceptions.OSError'>, OSError(13, 'Permission denied'), <traceback object at >

I changed permissions for softlink, script.py and index.html according to similar question OSError - Errno 13 Permission denied , which are:

ls -la 
-rwxrwxrwx  1 ampps    ampps 1819 Nov  8 21:08 index.php
-rwxrwxrwx  1 ampps    ampps 4391 Nov  8 21:15 script.py
lrwxrwxrwx  1 ampps    ampps   39 Nov  8 20:14 softlink -> 
/local/mnt/workspace/manifest/

I am not getting what else permission the folder or symlink requires, so that ampps server can access the folder. Thanks

piyush-balwani
  • 524
  • 3
  • 15
  • Did you try running the python script directly from the command line? – Samarth Nov 08 '18 at 16:20
  • `/local/mnt/workspace/manifest/` what filesystem does that point to? I mean, if the `ampps` user doesn't have permission to read filesystem mounted by someone else that might be the problem. – Federico klez Culloca Nov 08 '18 at 16:20
  • @Samarth Yes. From command line this is working absolutely fine. – piyush-balwani Nov 08 '18 at 16:22
  • @FedericoklezCulloca This folder is created by me. And I changed permission too of this folder. drwxrwxrwx 3 ampps ampps 4096 Nov 8 20:25 manifest – piyush-balwani Nov 08 '18 at 16:25
  • So you can confirm `/local/mnt/workspace` is not an actual mounted filesystem? In that case, why did you name it like that (not that it counts in the context of your question)? – Federico klez Culloca Nov 08 '18 at 16:29
  • @FedericoklezCulloca Actually, I know less about filesystem. Can you please help with command to check filesystem and permissions. Thanks a lot. findmnt -l command returns /usr2/piyush. – piyush-balwani Nov 08 '18 at 16:41
  • *"`findmnt -l` command returns `/usr2/piyush`"* if you mean without any other parameter, than it looks like `/local/mnt/workspace/manifest/` is not an actual mounted filesystem – Federico klez Culloca Nov 08 '18 at 16:45
  • Sorry, more specifically `findmnt -l | grep 'mnt'` command returns ` /local/mnt ext4 rw,relatime,data=or` and `findmnt -l | grep 'piyush'` command returns `/usr2/piyush nfs rw,relatime,vers=3,` – piyush-balwani Nov 08 '18 at 16:54
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/183315/discussion-between-piyush-balwani-and-federico-klez-culloca). – piyush-balwani Nov 08 '18 at 17:08

0 Answers0