PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 13th, 2003, 11:43 PM
vdeegan vdeegan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Irving, TX, USA
Posts: 5 vdeegan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Getting "Method Not Allowed" error (HTTP Error 405)

Hi,
I'm new to PHP and am getting 2 error messages with a test project:

First error msg (before pressing submit button):
"Notice: Undefined variable: MyEmail in
...php_mail_test.php on line 19"

Second Error(after pressing submit button):
"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."

============
Statistics:
============
1) Just installed the latest Windows Install version from PHP.Net and followed the install instructions.
2) Using Win 98 and PWS.
3) When testing my code originally on PHPIntro.com, it worked fine, but not on my own system.
4) Loaded script in my browser (IE6) using following URL: "http://localhost/php_mail_test.php".
5) I use a different home directory than the default home directory, in PWS. And the script is located in that new directory. PWS finds it and executes the HTML okay; but not the PHP part.
6) Here's the code (try viewing in a wide window to help make sense out of my code):

php Code:
Original - php Code
  1.  
  2. <html><body>
  3.  
  4. <form action="<? print $REQUEST_URI ?>" method=POST>
  5. Your email address:  <input type="text" name="MyEmail">
  6. <input type="submit" value="Enter">
  7. </form>
  8.  
  9. <?PHP
  10. //Uncomment the Mail() statement further below.
  11. //Mail() may not be enabled on this site.  If not, you won't
  12. //be able to test it here, but at least you can copy this sample
  13. //for your own use.
  14.  
  15. $MySubject = "PHP Email Test";
  16. $MyMsg = "It worked!";
  17.  
  18.  
  19. if ($MyEmail==NULL) print "You must enter an email address.";
  20. else {
  21.       //mail($MyEmail,$MySubject,$MyMsg);
  22.       print "nAssuming mail() is enabled on this site, the message, "$MyMsg", was sent to "$MyEmail" using the subject, "$MySubject".";
  23.      }
  24.  
  25. ?>
  26.  
  27. </body></html>


================
Thanks for any help.

Reply With Quote
  #2  
Old June 13th, 2003, 11:56 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Getting

to fix there first error, change line 19 to:

php Code:
Original - php Code
  1. if (!isset($MyEmail)) print "You must enter an email address.";


As for the other, I'm sorry I am not that familar with PWS. I assume there is some option in there somewhere to allow or disallow POST operations, such as the LIMIT directive in apache....

Reply With Quote
  #3  
Old June 14th, 2003, 12:01 AM
vdeegan vdeegan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Irving, TX, USA
Posts: 5 vdeegan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Getting

Thanks very much Matt. I'll give those suggestions a try.

Reply With Quote
  #4  
Old June 14th, 2003, 12:10 AM
drevele drevele is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medina, Ohio
Posts: 233 drevele User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to drevele Send a message via Yahoo to drevele
RE: Getting

To slove your first problem:
in your php.ini file:
Code:
error_reporting  =  E_ALL & ~E_NOTICE


Reply With Quote
  #5  
Old June 14th, 2003, 12:11 AM
drevele drevele is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medina, Ohio
Posts: 233 drevele User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to drevele Send a message via Yahoo to drevele
RE: Getting

oh also change your method from post to get

Reply With Quote
  #6  
Old June 14th, 2003, 12:11 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: RE: Getting


Quote:
To slove your first problem:
in your php.ini file:
Code:
error_reporting  =  E_ALL & ~E_NOTICE



That doesn't actually solve the problem, it just hides the error...

Reply With Quote
  #7  
Old June 14th, 2003, 12:12 AM
drevele drevele is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medina, Ohio
Posts: 233 drevele User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to drevele Send a message via Yahoo to drevele
RE: Getting

well true but.. works for me ..
with isset($MyEmail)
you would probly get 2 errors:
$MyEmail is not set
and
parm 1 missing from isset.
Something like that.

Reply With Quote
  #8  
Old June 14th, 2003, 01:59 AM
vdeegan vdeegan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Irving, TX, USA
Posts: 5 vdeegan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Getting

Actually, the isset() call did solve my first problem. No errors occured. Thanks Matt.

But, the 2nd problem is still there. When I change the request method from POST to GET, I no longer get the "Method not allowed" error, but then it comes up with a "Page cannot be Displayed" error. Not sure why. I also looked around for how to get PWS to accept POST as a request method, but haven't found anything so far.

Reply With Quote
  #9  
Old June 14th, 2003, 02:53 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: RE: Getting


Quote:
well true but.. works for me ..
with isset($MyEmail)
you would probly get 2 errors:
$MyEmail is not set
and
parm 1 missing from isset.
Something like that.


Actually the isset() function was made to check if a variable is set. That is its job....

Reply With Quote
  #10  
Old June 17th, 2003, 11:54 PM
drevele drevele is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medina, Ohio
Posts: 233 drevele User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to drevele Send a message via Yahoo to drevele
RE: Getting

yes but thereticly you would get an error

Reply With Quote
  #11  
Old June 17th, 2003, 11:57 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Getting

No...you wouldn't. Read the manual page for isset()...

Quote:
Returns TRUE if var exists; FALSE otherwise.



Reply With Quote
  #12  
Old June 18th, 2003, 12:03 AM
drevele drevele is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medina, Ohio
Posts: 233 drevele User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to drevele Send a message via Yahoo to drevele
RE: Getting

why i would think (if i didnt read that page):
if you use a var (if i read this properly) the preprosser fills in the space where the var is used. if the var is used with a function it should send the error

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > Getting "Method Not Allowed" error (HTTP Error 405)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |