| Coding Forum Problems with your code? Let's hear about it. |
03-06-2006, 10:20 PM
|
#1 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
PHP "Service Unavailable" caused by code error?
I am totally puzzled by this. I have a script that was working fine for months, now it's giving me an error "Service Temporarily Unavailable" half the time. It's a simple script, where you pass it some text and a few options and it prints it to a graphic and saves it as a gif. Now it's being picky about what text it will print, giving that error when it refuses. I can't correlate any particular change in text to when it errs. And I don't understand why my error handling doesn't work and it gives me the generic Sevice Unavailble error instead of giving a code error.
I've tried several different text strings, just random things, and made a list to try to identify what it's not liking, but like i said, i see no pattern.
For example this works just fine:
mystatus2.php?username=gnznroses&password=PASSWORD &text=*BFreeGadgets4Me%20%20:%20%20*GReceived%2 0$2 25*B||FreeComputerAddons%20%20:%20%20*GReceived%20 DVD%20Burner&font=crystal_clear&background=white
yet this doesn't:
mystatus2.php?username=gnznroses&password=PASSWORD &text=*BFreeGadge%20%20%20%20%20%20teive225*B||Fre eComp%20%20%20%20utner*B||Tr%20%20oon*B||Free%20%2 0%20%20%20%20Pae*B||&font=crystal_clear&background =white
Last edited by gnznroses : 03-06-2006 at 10:26 PM.
|
|
|
03-09-2006, 08:58 AM
|
#2 (permalink)
|
|
Contributing Member
Join Date: 03-22-04
Location: Cleveland, OH
Posts: 388
|
run a phpinfo() and post results.
|
|
|
03-09-2006, 02:02 PM
|
#3 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
not sure which part you need, so here's the whole thing:
http://bashfreebieguide.com/mystatus/info.php
someone told me that an error 503 like this means the server is down and that for the script to cause it that the script is bringing down the server, but i don't believe that. if it were my host would be yelling at me... but i do think it's some server problem, cause like i said it was working and i din;t change a thing, and now it isn't. tho i dunno what could change on the server to cause the script to accept some text in the query string and not other. if it helps, and if anyone actually wants to look at it, i can post the php source.
|
|
|
03-09-2006, 02:49 PM
|
#4 (permalink)
|
|
Inactive
Join Date: 01-18-06
Posts: 139
|
Service Unavailable should never be caused by your code (unless of course you're intentionally sending back a 503). You could be crashing (more likely in PHP5 than 4) or your server may be having some other problem.
|
|
|
03-10-2006, 07:05 PM
|
#5 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
hmm, if it were crashing the server wouldn't that mean everything on the server would be down at that time? i don't think that's likely cause liek i said, my host would be notifying me of it. i ahve no doubt tho that the script, and so the code, is directly or indirectly causing it. because the results can be reproduced every single time, given different query strings. here's the list i have so far if you want to try them yourselves.
Code:
this is the url i wanted to use and which i based the rest off of. it causes a 503 error.
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreeComputerAddons%20%20:%20%20*GReceived%20DVD%20Burner*B||Trainn:%20YourFreeFlatscreen:%20%20*GShipping%20Soon*B||FreePay:%20PCs:%20%20*GReceived%20:)*B||&font=crystal_clear&background=white
these work fine:
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreeComputerAddons%20%20:%20%20*GReceived%20DVD%20Burner&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreePay:%20PCs:%20%20*GReceived%20:)&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4M%20$225*B||Fner*B||T&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgeteive225*B||FreeComputner*B||Troon*B||FreePae*B||&font=crystal_clear&background=white
^has all the text, but chopped out in the middle
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadge------------teive225*B||FreeComp----------utner*B||Tr--------oon*B||Free------------Pae*B||&font=crystal_clear&background=white
these don't work:
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreeComputerAddons%20%20:%20%20*GReceived%20DVD%20Burner*B||Trainn:%20YourFreeFlatscreen:%20%20*GShipping%20Soon&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreeComputerAddons%20%20:%20%20*GReceived%20DVD%20Burner*B||FreePay:%20PCs:%20%20*GReceived%20:)&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadgets4Me%20%20:%20%20*GReceived%20$225*B||FreePay:%20PCs:%20%20*GReceived%20:)*B||Trainn:%20YourFreeFlatscreen:%20%20*GShipping%20Soon&font=crystal_clear&background=white
http://bashfreebieguide.com/mystatus/mystatus2.php?username=test&password=test&text=*BFreeGadge%20%20%20%20%20%20teive225*B||FreeComp%20%20%20%20utner*B||Tr%20%20oon*B||Free%20%20%20%20%20%20Pae*B||&font=crystal_clear&background=white
^same as the working one with added %20s
|
|
|
03-11-2006, 12:10 PM
|
#6 (permalink)
|
|
Inactive
Join Date: 01-18-06
Posts: 139
|
When I say crash I mean the PHP process crashing. That'll only bring down that one process and not the whole server, so the server can keep taking other requests.
For example, in the original release of PHP5, if you define a function and in that function make a global declaration to a variable which doesn't exist, then reference that variable, the PHP process will crash. Your apache error log should give some indication of memory allocation failure or something obscure like that.
Your URLs themselves have nothing to do with the error you're getting. It's definitely the code or something the code is doing to the server. Are your error logs showing anything interesting?
|
|
|
03-11-2006, 12:47 PM
|
#7 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
my last host had cpanel and you accessed logs form it, i forgot i can ftp to the logs with my new host... i checked and there is mention of the errors, but i don't know what it means:
[Fri Mar 10 06:35:54 2006] [error] [client 24.63.184.224] mod_security: Access denied with code 503. Pattern match "\\|+.*[\\x20].*[\\x20].*\\|" at THE_REQUEST. [hostname "bashfreebieguide.com"] [uri "/mystatus/mystatus2.php?username=USER&password=PASS&text=Any Gift4Two%20%20:%20%20*G0%20/%202*B||FreePay:%20GiftCards%20%20:%20%20*G4%20/%205%20%20*Y(1%20Pending)*B||FreePay:%20Laptops%20 %20:%20%20*G0%20/%2020*B||FreePay:%20PS3s%20%20:%20%20*G0%20/%208*B||FreePay:%20PSPs%20%20:%20%20*G0%20/%205*B||FreePay:%20XBox360s%20%20:%20%20*G0%20/%208*B||Trainn:%20YourPS34free%20%20:%20%20*G0&fon t=gapstown&background=transparent"]
etc.
|
|
|
03-11-2006, 03:17 PM
|
#8 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
hmm, don't see a way to just Edit....
anyways, what's that "pattern match" crap it's taking about? i do some string replacements, and some InStr or whatever, but i would think any errors with that would just cause a normal error and tell me the line number it happened at.
|
|
|
03-11-2006, 08:28 PM
|
#9 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,857
Latest Blog: None
|
try turn error logging on E_ALL
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
03-11-2006, 08:45 PM
|
#10 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
umm, did that, but for some reason i have an error.log that was only last updated hours ago. it only has some file not found errors. those are in another access.log.2006-03-10 which obviously was not updated since yesterday. dunno why...
looking at the pattern, from my understanding it matched this:
at least one | followed by any char (or no char at all), followed by a space, then any (or no) char, then another |
and deemed that a security risk...
-edit-
that pattern matching as i've figured out can't be right or else none of the links i posted earlier would work, cause all of em would have a match...
Last edited by gnznroses : 03-11-2006 at 09:03 PM.
|
|
|
03-11-2006, 10:00 PM
|
#11 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
edit button is gone again... must be a time-based thing... anyways,
i was wrong, my error.log does have the latest errors. they're at the end of the file, not the beginning like my old host. i don't see any difference tho with the E_ALL turned on.
|
|
|
03-11-2006, 10:45 PM
|
#12 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,857
Latest Blog: None
|
strange, might be causing a strange memory error
try asking your host to see if they have any idea
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
03-12-2006, 02:43 AM
|
#13 (permalink)
|
|
Contributing Member
Join Date: 01-22-06
Location: Exeter, East Devon, England, UK
Posts: 768
Latest Blog: None
|
Your host may have installed a hotfix to address a security vunerability and your script is now no considerd to be secure.
|
|
|
03-12-2006, 07:02 AM
|
#14 (permalink)
|
|
Technical Support
Join Date: 12-14-05
Posts: 127
|
The relevant bit is in bold;
Quote:
|
Originally Posted by gnznroses
[Fri Mar 10 06:35:54 2006] [error] [client 24.63.184.224] mod_security: Access denied with code 503.
|
You host has the apache mod_security module installed and your url is falling foul of one of the its rules.
|
|
|
03-12-2006, 01:16 PM
|
#15 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
i figured it out. i think it was looking for a || in the url. so i simply changed it so that it uses ;; instead and now it works fine  i was using the || just to represent a linebreak.
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:53 PM.
© Copyright 2008 V7 Inc
|