PHP upload script

They have: 58 posts

Joined: May 2001

Hey all! How is it going?

I have a question reguarding PHP again (I posted a similar question a long time ago). I am using PHP to handle file uploads to my NT server. I had it going great for quite a while, but my server crashed and low-and-behold, my backup didn't have my php.ini file in it. Now, after reconfiguring a new one, whenever I try to upload, I get a cool little error that says:

-------------------------------------------------
HTTP Error 405

405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper MIME type set up for the resource you are requesting.

Please contact the server's administrator if this problem persists.

-------------------------------------------------

I checked my source and the method on my form is set to "POST". The enctype is set to "MULTIPART/FORM-DATA" and the action is pointing to my PHP script.

I have made sure that the file which I am uploading to has full access rights.

I believe that the problem lies in my PHP installation or something, but I am not sure. I created and tested a simple e-mail script in PHP which had the exact same results.

-------------------------------------------------
I am running:

> PHP 4.1.0
> Windows NT 4.0 SP 6 with IIS

-------------------------------------------------

I am totally lost right now. Anyone have any ideas?

Zimbabwe

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Hmm, did you install PHP with an account that had administrator access? What account is the PHP service running under? Sounds like a permission thing to me.

PJ | Are we there yet?
pjboettcher.com

They have: 58 posts

Joined: May 2001

Thanks for repling,

I did install PHP using the administrative account. I agree that it is a permissions problem, but I don't know where. I tried giving all the directories full access permissions that have anything to do with PHP. It didn't change anything so I changed them back...I probably don't want my servers hacked right after rebuilding them.

Any other suggestions?

Zimbabwe

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Try adding the IUSR_machinename & IWAM_machinename user accounts to the administrator group. Stop and restart IIS and see what happens. Don't leave it like this though, its a major security risk, I just want to see if it makes anything work.

PJ | Are we there yet?
pjboettcher.com

They have: 58 posts

Joined: May 2001

I did try this, but still gave me the same thing.

Any other ideas?

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Hmm, I'm starting to run out of ideas. Where is your php.ini file? (should be in \winnt\ folder) Check the permissions of the php.exe file (not just the folder). I think with IIS4 you have to setup PHP a little different (setup as a script engine), but I don't know for sure.

PJ | Are we there yet?
pjboettcher.com

They have: 58 posts

Joined: May 2001

Well, I tried switching over to a win 2000 server, but that doesn't seem to help much. I also noticed that whenever I tried to upload a file larger than about 50k, it would give me a "can not find server" error.

I am going to try going back to PHP v 4.0.5 instead of 4.1.0. I had this version going, but it didn't work with win 2000.

I really would like to run 2000... do you know anything that would help get my script going on 2000 with PHP v 4.0.5?

They have: 58 posts

Joined: May 2001

I do have the php.ini file in the winnt directory and the permissions on php.exe as well as php4ts.dll have execute permissions for IUSR_machinename.

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

I'm tapped out, did you check the documentation at: http://www.php.net/manual/en/install.windows.php

Maybe something there might help.

They have: 58 posts

Joined: May 2001

Do I need to have perl installed?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

No. PHP is independant from PERL. Nothing to do with each other.

They have: 58 posts

Joined: May 2001

Ok, now I got passed the problem of the error 405 by going into MMC and adding the PHP path and extension info. Now when I try to post something to a simple form-mail script, it comes back saying that every field is undefined. I double-checked to make sure that I was using POST and MULTIPART/FORM-DATA in the form and that all my input fields were named properly.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

what is MMC ?

They have: 58 posts

Joined: May 2001

MMC is the Internet Service Manager on NT IIS 4... I think that it stands for Microsoft Management Console or something like that.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

When you say 'simple form-mail script', do you mean forms in general or a specific script 'form-mail'?

They have: 58 posts

Joined: May 2001

It is a form to e-mail script. The form is in HTML and the script is in PHP.

He has: 2 posts

Joined: Jan 2002

I have a couple of suggestions. My first post on this board so I apologize if I'm not exactly sure of the protocol here.

You might want to check that php.ini file more closely. I don't use PHP with IIS anymore, only Apache, but if memory serves, I've seen a similar problem before.

Also, when troubleshooting it usually pays to look at the first variable. Your php.ini was missing and you replaced it with a new one. Unless your backup didn't properly pass the permissions back to the server files, that probably isn't the source of your problem. If you were using 2000 instead of NT, or if encryption was enabled, that's a different story.

There several areas in php.ini that could impact you in the way you describe. It may not be exclusively a permissions issue, rather a combination of the two.

Finally, you might consider posting or pm'ing the file and have a fresh set of eyes look at it.

I know how frustrating this can be. Wanted to give you a couple of different avenues to pursue. Sometimes that helps keep us from going in circles. Smiling

HTH.

"It's a small world...
But I wouldn't want to paint it!"
Stephen Wright

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Welcome to TWF, Stretchr!

zimbabwe, have you tried using forms for something other than email?

He has: 2 posts

Joined: Jan 2002

Thank you. I'm very envious of your board. Excellent display and content!

They have: 58 posts

Joined: May 2001

Mark - I have also tryed an upload script which was giving me the problem in the first place.

Stretchr - I will get a copy of the scripts ready so that you guys can look at them... I just need to take out some information first (eg.. servers / passwords).

I should have those rdy by tonight.

Thanks for your time

Zimbabwe

mjs416's picture

They have: 127 posts

Joined: Dec 2003

In order to isolate your problem to a php or coding error; run the php info script on the server and see what happens. If you get the list of php information, then the php is working.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.