move_uploaded_file from server to server

We would like to utlize the Move_Upload_File to get a file to another
web server.  We are currently using Windows Server 2003 with PHP on
them.  However I am sure I have a file permission issue on the
targetted server box (since its going from one box to another), but I
am not sure how to force PHP to use a specific user (since its a subset
of IIS, it almost looks like it uses Anonymous - which will not work
for the scenerio I am looking at that I am aware of).

Any Help would be appreciated - here is a snipet of our code:


move_uploaded_file($_FILES['upload']['tmp_name'],"\\server2\share\directory­\$filename")

gregsopcakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAelbrechtCommented:
it is using the IISR_USR (or something very similar) as user.
if you want it to be able to access a share with a password, you have 2 choices:
either run PHP cgi as another user who does have access (i don't know how, though)
or
give the share write permissions for the IISR_USR user (which is imho, way more secure, especially if you only give him file creation rights; this way this user can never overwrite files there or even read them)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
str_kaniCommented:
I would move it to the other server using ftp, that will be better and safe in my view.
gregsopcakAuthor Commented:
What are the FTP commands in PHP?

Thanks!
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Richard QuadlingSenior Software DeveloperCommented:
It makes little difference HOW you move the files between servers. As long as you have permissions, you can do it.

You COULD simply allow everyone access to the share!

As far as using FTP, you will need to have an FTP server running on the second server. There is no point in using FTP to do this.

You don't need it. Just get the permissions right. Try asking the permissions question in the IIS section http://www.experts-exchange.com/Web/Web_Servers/IIS

AndyAelbrechtCommented:
i have to stress how much I agree with RQuadling here and not with str_kani (sorry mate).

setting up an ftp server (which uses plain text passwords) to upload stuff to a directory that's already available on a local share is overkill and not needed. NTFS authentication is alot safer.

setting up an ftp server is just too much of a hassle, get the permissions on the folder right and you're done :-)
Richard QuadlingSenior Software DeveloperCommented:
Is your PHP fully active? Are you running safe mode or restricted directory usage?

There are many securities within PHP which could also stop you accessing the files.

gregsopcakAuthor Commented:
I did do an FTP and it worked great.. but I would still be interested in using the NTFS.. However its aniling down what user PHP is using to access it... I am not able to grasp it as its not a "service" but runs from IIS...

I am running in normal PHP in ISAPI mode... Its a precompiled version (I didnt compile it - downloaded it from php.net)
AndyAelbrechtCommented:
hey gregsopcak,

like i said in my first comment, the user that IIS runs under is the "IISR_USR" or something very similar.
just look thru your local users (on the server that is running the IIS) and you will find this user pretty fast.

give this user the proper NTFS rights on the share you want to access ! :)
Richard QuadlingSenior Software DeveloperCommented:
A daft way to find the IIS user is to create a directory with everyone having full rights.

Then use PHP to create a file in that directory.

Then check the owner.

I'm sure there are other ways, but with different versions of IIS the user changed.


You should be able to check the IIS service account within Control Panel -> Services. It probably will NOT be LocalSystem or NetworkService, but something else.

gregsopcakAuthor Commented:
I setup a copy of the IUSR on the other server and give it file rights to the share and etc, however its still not working...

As far as the IIS Admin Service account is setup as Local System I believe, not the IUSR user.. should I change that to be that IUSR on the server sending so hopefully it uses that?
Richard QuadlingSenior Software DeveloperCommented:
I think the IIS service is WWW Publishing or something like that? IIS Admin Service is a service to administer IIS which would only need local rights.

It may be better to ask this question (or at least put a pointer question) in the IIS section here on EE.
Richard QuadlingSenior Software DeveloperCommented:
Ah. It MAY be something like ...

DOMAIN\IWAM_SERVER or DOMAIN\IUSR_SERVER

So, say your domain is COUNTDOWN and the webserver is WWW, then try ...

COUNTDOWN\IWAM_WWW or COUNTDOWN\IUSR_WWW

Richard QuadlingSenior Software DeveloperCommented:
Split
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.