[Phpwm] Changing the scripts user
Andy Cowan
andy at w4.co.uk
Tue Mar 17 13:00:42 UTC 2009
On 17 Mar 2009, at 12:40, Mike Tipping wrote:
> I have a script running on a clients windows (under IIS) server
> which is
> trying to use file_get_contents() to access a csv file from yahoo
> finance.
> Works fine on my Linux test server but the windows user account that
> is
> running the website on the clients server doesn't have the right to
> access
> external websites so the script fails.
>
> And the client won't enable that right on the user.
>
> Is there a way in the PHP script I can change the user that is
> running the
> script or get file_get_contents() to execute as a different user?
>
No - if you think about it, the point of having a permissions system
is to prevent people/processes from doing things they aren't allowed
to - usually a permissions system will allow you to drop permissions
you don't need, but shouldn't provide a way of acquiring permissions
you don't have.
You have two choices AFAICS, give the IIS user permission to access
remote sites, or run your script in a new application pool under IIS
as a different user that does have permissions to access remote sites.
It's not a PHP problem, it's an OS problem I'm afraid.
Cheers,
A.
More information about the Phpwm
mailing list