Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

unlink() permissions

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

unlink() permissions

Postby cjm51213 » Mon Jun 10, 2013 10:16 am

Hi Folks,

I'm running PHP 5.3.13 on IIS 7. At the end of my script I need to unlink() expired files which are on a NAS that is a member of the AD Domain. As you can guess by the title, this is failing for permissions restrictions.

I need to know the credentials I am using as the webserver so I can adjust the permissions on the NAS accordingly. Is there a script equivalent to phpinfo() that would output to my log the security principals of the process running my script?

Also, I learned that the view of the filesystem from PHP, under IIS 7 at least, is not the same as the filesystem as viewed from a command prompt. There are executables that are visible from the command prompt that are not visible from a PHP script and vice versa. Does anybody have an explanation for this? For instance, I wanted to run WBAdmin from a PHP script only to find that it is not visible to PHP!!!

Thanks for the help,

Chris.
cjm51213
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jun 10, 2013 10:13 am

Re: unlink() permissions

Postby johnj » Wed Jun 12, 2013 5:50 am

to unlink expired files, you must have write permission on those files.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: unlink() permissions

Postby cjm51213 » Wed Jun 12, 2013 11:36 am

Hi Jonhj,

I don't think that is true. I think you need write permission to the directory containing the files. In any case, the problem is a bit trickier.

Thanks for the help,

Chris.
cjm51213
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jun 10, 2013 10:13 am

Re: unlink() permissions

Postby johnj » Thu Jun 13, 2013 9:59 pm

In any filesystem, you ought to have read access to the folder/directory in order to access a file in it - this is implied.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: unlink() permissions

Postby johnj » Thu Jun 13, 2013 10:05 pm

maybe the exec() function php might be useful to you to run commands from php on your NAS.
http://php.net/manual/en/function.exec.php
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron