Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 03-06-2006, 09:20 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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 09:26 PM.
 
Reply With Quote
  #2 (permalink)  
Old 03-09-2006, 07:58 AM
jwalsh's Avatar
Contributing Member
Latest Blog:
UX Tour 2013 Recap

 
Join Date: 03-22-04
Location: Cleveland, OH
Posts: 269
iTrader: 0 / 0%
run a phpinfo() and post results.
 
Reply With Quote
  #3 (permalink)  
Old 03-09-2006, 01:02 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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.
 
Reply With Quote
  #4 (permalink)  
Old 03-09-2006, 01:49 PM
veridicus's Avatar
Senior Member
 
Join Date: 01-18-06
Posts: 134
iTrader: 0 / 0%
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.
 
Reply With Quote
  #5 (permalink)  
Old 03-10-2006, 06:05 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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
 
Reply With Quote
  #6 (permalink)  
Old 03-11-2006, 11:10 AM
veridicus's Avatar
Senior Member
 
Join Date: 01-18-06
Posts: 134
iTrader: 0 / 0%
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?
 
Reply With Quote
  #7 (permalink)  
Old 03-11-2006, 11:47 AM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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.
 
Reply With Quote
  #8 (permalink)  
Old 03-11-2006, 02:17 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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.
 
Reply With Quote
  #9 (permalink)  
Old 03-11-2006, 07:28 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
try turn error logging on E_ALL
 
Reply With Quote
  #10 (permalink)  
Old 03-11-2006, 07:45 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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 08:03 PM.
 
Reply With Quote
  #11 (permalink)  
Old 03-11-2006, 09:00 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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.
 
Reply With Quote
  #12 (permalink)  
Old 03-11-2006, 09:45 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
strange, might be causing a strange memory error

try asking your host to see if they have any idea
 
Reply With Quote
  #13 (permalink)  
Old 03-12-2006, 01:43 AM
WorldwideTrading's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 01-22-06
Location: Exeter, East Devon, England, UK
Posts: 564
iTrader: 0 / 0%
Your host may have installed a hotfix to address a security vunerability and your script is now no considerd to be secure.
__________________
Current Project: http://www.starrecottages.co.uk/
 
Reply With Quote
  #14 (permalink)  
Old 03-12-2006, 06:02 AM
Paul M's Avatar
Contributing Member
 
Join Date: 12-14-05
Posts: 73
iTrader: 0 / 0%
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.
 
Reply With Quote
  #15 (permalink)  
Old 03-12-2006, 12:16 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-05
Posts: 106
iTrader: 0 / 0%
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.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google's "Unavailable After" Meta Tag Live peter_d Google Forum 6 08-03-2007 04:30 PM
Need help with creating an "error" on registration :) Alternus Coding Forum 2 06-10-2007 07:36 AM
PHP: What is code for "Only user with avatar" - i am using vbulletin basketmen Coding Forum 3 04-17-2007 07:40 AM
"Method POST not allowed" error east_pole Web Design Lobby 3 02-16-2007 01:57 PM
Home page with "latest news", "news archive" and "update" tekitouni Web Design Lobby 1 09-19-2006 07:39 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:56 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.