windows 2016, php dns query fails unless first run as admin

Viewed 74

Been trying to figure out an issue not being able to use php's dns_get_record when called in a webpage under IIS. Thru some trial an error i figured out it was a permission issue. I think I confirmed this when i temporarily added the app pool user the webpage was running under as part of the admin user group. Suddenly it started working. And surprisingly, it kept working even after i removed the app pool user from the admin group. I have 2 versions of php installed on the server. It was not working on either version. And now it works on both versions.

My guess at this point is that it wants to write to some temp/cache file and as a user it has permission to write to the file, but does not have permission to create the file. When i added it to the admin group it was able to create the file. This is purely a guess on my part.

Since i don't know the exact cause, i can't be sure it's really fixed. So would really appreciate if anyone might have a better idea of what's going on and how i can make sure it's fixed permanently.

Update1: some additional info - after removing admin rights on the app pool user, i can restart the app pool or even restart IIS through the IIS control panel and it keeps working. But, if i restart IIS using iisreset, it stops working until I give admin rights again and then run it once. I'm not sure what's different between restarting IIS in the IIS control panel, or using IISRESET, but something causes it to stop working again using iisreset.

Thanks

0 Answers
Related