How To Fix 503 Service Unavailable Error in WordPress - WP ...
文章推薦指數: 80 %
When you encounter 503 error with WordPress, it means that the server in question is unavailable. Most of the time, it just shows up with a ... HomeWordpressManagementWordPressMaintenanceHowToFix503ServiceUnavailableErrorinWordPresssite? UpdatedonMay6,2022 HTTP503ErrorWordPress TableofContents[TOC]HTTP503ErrorWordPressWhatIs503theServiceisUnavailableerror?httperror503.theserviceisunavailableErrorCauses ByincorrectconfigurationHowtoFixtheHTTPerror503ServiceUnavailableinWordPress?DisableWordPresspluginsRemoveanddeactivateWPthemeEnableWP_DEBUGFaultyPHPCODELimitGoogle’sCrawlRate(Server-Related)LimitWordPressHeartbeatHowToPreventHTTP503errorinWordPress UpgradetoaBetterHostingPlanUseaContentDeliveryNetwork(CDN)Summary:httperror503.theserviceisunavailable.Likethis:Related WordPressisthemostpopularandusedCMSintheworld,hasasupersimpleinterfaceandalsodoesnotrequiremuchtechnicalknowledgesowecangetitgoing.However,therearesituationsinwhichwecanfindseveralerrorsthatarenoteasytosolve,asinthecaseof⚠️503serviceunavailableWordPresserror. Wearegoingtodedicatethisarticletothisparticularerror,sothatyouwilllearnhowtofix503serviceunavailableerrorinWordPressandyouwillalsodiscoverwhyithappens. WhatIs503theServiceisUnavailableerror? OntheInternet,therearedifferentcodestodesignatethedifferenttypesoferrorswithwhichwecancrossincertainsituations.Forexample,a404errorindicatesthattherequestedcontenthasnotbeenfound,justasa403errorindicatesthatthereisaFileandFolderPermissionsErrorinWordPresssite,anerror500meansinternalservererror. Intheworldofhosting,error503⚠️meansthattheserverhasreceivedourrequestbuthasnotbeenabletoprocessit. Whenyouencounter503errorwithWordPress,itmeansthattheserverinquestionisunavailable.Mostofthetime,itjustshowsupwitha“Servicetemporarilyunavailable”message.Ifyou’relucky,the503errorcodewillhaveoccurredbecauseyourWordPresswebsiteisundermaintenance. WordPressverybrieflysetsyoursitetomaintenancemodewhenyou’reupdatingaplugin,atheme,orthecoresoftware.💡[FixWordPressStuckinMaintenanceMode–Tutorial] Tounderstandit,wemustknowhowaserverworks.Tostopbeatingaroundthebush,ourbasicexplanationisthatthebrowsersendsarequestornumberofrequeststotheserver. Thisrespondswithacodeanddispatchingthesite,thementionedcodeisusually200toindicatethattherequestwassuccessfullydispatched.Incaseofanyproblem,theresponsecodewillchangeanda503error⚠️indicatesthattherewasindeedaproblem. Forexample,youcanseetheseerrorcodesinstead: ⚠️503ServiceUnavailable ⚠️Http/1.1ServiceUnavailable ⚠️HTTPServerError503 ⚠️503Error ⚠️HTTP503 ⚠️HTTPError503 Inthistutorial,wewillshowhowtodebugandfixhttp503serviceerrorinWordPresssites.Firstly,youneedtounderstandwhatarethemostcommoncausesofError503(ServiceTemporarilyUnavailable).Afterthat,you’llneedtofollowseveralstepsinordertolocatetherootcauseandfixHTTP503ServiceUnavailableErrorinWordPress. httperror503.theserviceisunavailableErrorCauses The503errorisadistributionservererrorthatoccurswhenyourservercannotdistributeafiletoanotherserver.Itmeansthereisaproblemwiththefileorwithyourhostingprovider.Sometimes,thiserrorcanoccurifyouhavemadechangestoyourwebsitebutforgottoupdatesomepluginsorthemes.Or,ifyouweretryingtoaccessfilesonyourwebsite,buttheywerenotuploadedcorrectly. Inmostcases,thiserroroccurswhenthereisaproblemwithyourwebhost’sserverornetworkconnection.Youmayalsoseethismessageifsomeoneelsehastriedtoaccessyoursiteatthesametimeasyou(thishappensoften). A503ServiceUnavailableonFreshInstalloronanalreadyrunningsitecanbecausedby anumberofthingsincluding(butnotlimitedto): Infectedpluginsorthemes–[ReadHowtoscanMalwareinWordPressThemes] AmisbehavingcustomPHPscript–[ReadWebShellPHPExploit] Insufficientserverresources–[ReadThisAccountHasBeenSuspended–WordPressDown] Serverglitches–[ReadErrorEstablishingaDatabaseConnectioninWordPress,FileTypeIsNotPermittedForSecurityReasons] WordPressMalwareattack/hack–[AlsoRead💡HowToRemoveMalwareinWordPresssite] Youmaybedoingsomemaintenanceatthattime.Forexample,ifyouaremakingabackupofyourwebsiteorifyouareoptimizingWordPressimageswithaplugin,thisimpliesanormallyhighresourceconsumption,whichcanleadtoa503error. Itcouldalsobeaconfigurationproblem.Ifyouhavemanuallyenteredrulesinthe.htaccessfileorsomecodeinaphpfile(forexample,todoaredirectortoconfigureGoogleAnalytics)andyouhavemadeamistake,thefilemaybehaveincorrectlyandthismayleadtoanerror503(althoughthemostnormalthingisthatitresultsina500error). Theinteractionsbetweenpluginsandtemplatescanalsoaffect.EachWordPresscomponentisusuallyprogrammedbyadifferentdevelopmentteam,whichmaycauseincompatibilitiesnotknowntoeachother.Theseincompatibilitieswillresultinhighconsumptionofresourcesand,asaconsequence,endsupinanerror503. Apeakinwebsitetrafficcancausea503errorifyouhavenottakentheappropriatemeasures. Themostcommonisthatyourwebsitehasjustgrownandyouneedtobuybiggerhostingorwithbettermaintenance. Asyoucansee,therearemanypossiblecausesfora503error.Therefore,youhavetogostepbystep,testinganddiscardingpossibilitiesuntilyoufindtheoriginofyourspecificproblem. “Througherror503,theserveristellingyou:“RightnowIamverybusy.Pleasecomebacklater.” Aswehavebeensaying,error503istellingusthatthewebserveratthistimecannotsendtherequestedresources.Thiscanbeatemporaryerrororitcanbeafixederror,thatistosay,itwillnotgo“byitself” Thereareseveralcausesbehinda503error,amongwhichwecanfindproblemsatthelevelofthenetwork,anerrorintheconfigurationoftheDNSortheDNSzoneofthedomaininquestion,orevenaproblemofresourcestodispatchtherequest(duetoanoverload,forexample). Aswesaid,thecausesofa503errorcanbeseveral,andobviously,WordPressisnottheonlysystemthatcanpresentanerrorofthistype,infact,itcanhappentovirtuallyanykindofsite. Leavingasidealreadymentionedcausessuchasoverloads,DNSproblemsornetworkfailures,mostofthe503errorsinWordPresshavetheiroriginintheuseoftheirownscripts.Here,wearetalkingaboutthosescriptsthatarenotpartofthedefaultstructureofWordPress,aswellasitcanalsobegivenbyproblemsgeneratedatthelevelofpluginsoreventhesideofthethemethatweareusing. Thecausesof503serviceerrorinWordPresscanbe;problemsattheserverlevelaswellasbysomeconflictonthesiteitself.Thismeansthatthereisnouniversalsolutionforthiserror,butmustberesolvedaccordingtoeachcase. Byincorrectconfiguration IfmodifyingWordPressfilesyouhavecauseda503serviceunavailableerror,youhavetorestorethebackupyouhavemadeofthefilesbeforemodifyingthem.Butwhatifyoudonothaveabackup?Well,youhavetodoseveralthings: Ifitisafileofapluginortheme,youcandownloaditagainfromtheofficialrepository. Ifthisisnotpossible,youcanseeifyourhostingproviderhasarecentcopyofthefile. Inbothcases,youshouldgotothenearesttattoostudiotohavetheword”BACKUP”writtenonComicSansonthebackofyourhand.Sosurelyforthenext,youdonotforget.🙂 Therewillbesituationsinwhichyousimplycannotknowtheoriginoferror503.Especially,ifyourhostingplanisshared,youwillnothaveaccesstosomeimportantlogsfordiagnosis;andanyway,somechecksareverytechnicalandyoucanescape. That’swheretheimportanceofthetechnicalserviceofyourhostingcomesintoplay.Ifafterfollowingtheguidelinesofthisarticleyouarenotclearabouttheproblem,youshouldnothesitatetocontacttheexpertsofyourhostingcompany. Althoughsometimestheycannotgiveyouadirectsolutiontotheproblem,surelytheycanhelpyoutohaveaclearerpictureofthesituationandproposesomesolutionstothe503error. HowtoFixtheHTTPerror503ServiceUnavailableinWordPress? Fortunately,ingeneral,thiserroriseasytosolve,althoughreachingthissolutionmaytakesometimedependingonwheretheproblemoriginates. Basedontheclient-servermodel,severalofthecausesmaybeontheserverside,inwhichcasetheonewhowillberesponsibleforresolvingitwillbetheadministratoroftheserver.Ifyouhaveagoodhostingprovider,thenitshouldnottakelongtosolveaproblemofthistypethatisoriginatingattheserverlevel. Butwhathappensiftheerrorarisesfromoursite?Inthatcase,wemustgetdowntoworkandfirstofall,examinethesources.WehavementionedsomeofthefixesyoucanimplementinordertoFix‘503ServiceUnavailable’WordPressError DisableWordPressplugins Inthecaseofplugins,thebestthingwecandoisstartdisablingthemonebyone. ThiscanbedonedirectlyfromtheWordPressadministrationpanel,justenterthereandyouaredeactivatingthepluginsonebyoneandtestingthesite,untilyoufindtheproblematicone.Whatifyoucannotaccessthepanelbecauseitalsogivesanerror? Inthatcase,wehavetoputonglovesandgetdowntowork,sincewearegoingtodeactivatethepluginsfromanFTPmanager,althoughthecPanelfilemanageralsoworks. BymeansofanFTPmanager,wewillhavetoenterthewp-content/pluginsfolderofoursite,andtherewewillseethefoldersofeachplugin.Whatwewilldoistoremovepermits(thatis,assignpermissions000)onebyoneandtestingthesite. Belowarethestepsindetailstofollow: AccessyourserverusinganFTPclient Locateafilewhichisoftennamedpublic_htmlWordPressrootfolder Navigatetothewp-contentdirectoryfromtherootfolder Lookfor“plugins”folder,right-clickonit,andchoosetheRenameoption.RenamepluginsfolderwithFileZilla Changethenameofthepluginsfoldertosomethingsuchasplugins-deactivatedoranythingelseyoulike,aslongasyourememberwhatitis. TryaccessingyourWordPresswebsite. ThisprocessissimilartowhatwewoulddofromtheWordPressadministrator,justkeepinmindthatyoumayneedtoreconfigureyourpluginslater.Ifyouhittheproblematicplugin,youcanreturnthepermissionstothepreviousones,usingthefollowingsettingshouldbeenough: 755forallfoldersandsub-folders. 644forallfiles. Great,you’vefoundtheproblematicpluginbutyouhavetoleaveitdisabledbecauseitbreaksyoursite,whattodointhatcase? Inthatsituation,thehelpshouldcomefromthepluginprogrammer,whichistheteamorpersonwhodevelopedit,sogetintouchwiththedeveloperoftheproblematicpluginandreportthesituation. RemoveanddeactivateWPtheme Ifyouhaveperformedtheseproceduresanddonotfindaproblematicplugin,thenthereisapossibilitythattheerroriscausedbythethemeortemplateyouareusing. Ifso,youwillhavetoperformthesameprocessthatyoudidwiththeplugins,butthistimedeactivatingthetheme. YoucandoitfromtheWordPressadministratoror,ifitisnotavailable,throughFTPorafilemanager.RememberthattemplatesinWordPressarestoredwithinwp-content/themes.Searchyouractivethemethereandput000permissionsonitorchangeitsname,andthentestyoursite. GetaccesstoyourcPanelusinganFTPclient. Locatethewp-content/themesfromtherootdirectory. Navigatetoafolderthatsharesasimilarnametoyouractivetheme. Right-clickonthetheme’sfolderandchoosetheRenameoption. Changeyourthemenametomytheme-deactivated GotoyourWordPresswebsiteandreviewitasavisitor. Ifthewebstartsworkingthenthe503erroriscausedbyyourtheme.Youcantrytodownloaditagain,maybeonlyonefileismissingandthatcausestheerror,oryouwillhavetocontactitscreatorandpresentthecase.Ifyoucannotgetasolutiononthatside,thensurelyyouhavenochoicebuttochangethethemeofyoursite. EnableWP_DEBUG Finally,theotherpossiblecauseofournightmaresmaybesomescriptwehaveonthesite.Inthatcase,thebestoptionwecantakeistoenablethesampleoferrors,otherwise,itwillbeverydifficulttofindtheproblembydoingamanualsearchbetweenscripts. EnableWordPressDebugFeature Butsincethe503erroroftenlocksyououtofyourWordPressadmin,weshalluseWP_DEBUGandWP_DEBUG_LOG,WP_DEBUG_DISPLAYand@ini_setconstantsavailabletoWordPress. ToenabledebugmodeinWordPressandwriteerrorstoalogfile, followthesesteps: OpenyourWordPressdirectoryviaFTPorFileManager. Openthewp-config.phpfile ScrolldowntowhereWP_DEBUGisdefined.Itlookslikethisdefine('WP_DEBUG',false);.Ifitismissing,wewilladditjustabovethelinethatsays /*That'sall,stopediting!Happyblogging.*/ InserttheDEBUGmagiccodes.Justchangetheabovedefine('WP_DEBUG',false);codeto: define('WP_DEBUG',true); define('WP_DEBUG_LOG',true); define('WP_DEBUG_DISPLAY',false); @ini_set('display_errors',0); Savechanges Thisfilecontainsalltheerrorsonyourwebsite.Ifyour503serviceunavailableerroriscausedbyacustomcodesnippet,itwillshowupsomewherewithdetailsoftheerror. FaultyPHPCODE ToenablethesampleoferrorsinPHPthereareseveraloptions,perhapsthesimplestistoopenourfilewp-config.php(locatedattherootofthesite)andaddneartheendofthefollowingline: ini_set(‘display_errors’,0); Wemustplaceitinthepositionindicatedintheimage,notinthelastlineofthefile. Wesavethechange,wetestthesiteandweshouldseewherethesourceoftheerrorislocated. Ifforsomereason,wecannotaccessthismethodtoshowPHPerrors,thenwecanchoosetodoitthroughouruser’sPHP,aslongaswecancustomizeitclearly. Thisshouldnotbeaproblemifyourhostingprovidesamodernserver(suchasLiteSpeedorNginx)withcustomizablePHP,forexample,ifyouhavecPanelitis99%surethatyoucanconfigurethevariabledisplay_errorsatease,askyourprovidertoturninon/off. Intheimagebelow,wecanseewheretomakethischangeintheinfrastructureserversthroughthePHPSelectoravailableincPanel. AnotherwaytoactivatethedisplayoferrorsinPHPusingdisplay_errorsisdirectlyeditingthephp.inioftheserver,butwemustbearinmindthatforthisitisnecessarythatwehaverootaccesstotheserver,anditisalsoessentialthatweknowhowtousetheconsole. IncaseyouactivatePHP’sdisplay_errors,regardlessofwhetheryoudiditthroughwp-config.phporwithoneoftheotherdescribedmethods,remembertodeactivateitwhenyounolongerneedit,sincehavingitactivepermanentlyisaseriousfailuretothesecuritylevel. Keepinmindthatleavingthevariabledisplay_errorsstatus“On”maycausepartofyourcode,fileandfolderstructuretobeshown,andthatcanbeusedbythirdpartiestohackyoursite,uploadmaliciouscontent,etc. Related–WordPressHTTPImageUploadError LimitGoogle’sCrawlRate(Server-Related) Specifically,Google’scrawlisasoftwarewhosemainmissionistoexploretheWebtoanalyzethecontentofdocumentsvisitedandstorethemorganizedinanindex. Thecrawler,therefore,travelscontinuously,autonomouslyandautomatically,thevarioussitesandInternetpagesinsearchofnewcontentorpossibleupdatesofcontentalreadyexploredinthepast. Google’smaximumcrawlratecanbeanotherreasonthatcauses503errorinWordPress,whichcanbefixedbyfollowing3tips: Increasethehostingpackagessoyouwillhavemoreresources. Slowdowntheworkanddonotupdateanythingforawhile.Obviously,you’regoingtomissvisits,butsometimesit’stheonlyoption.Whenthetrafficnormalizesyouwillrecoverthenormaluseoftheweb. OptimizeWordPresssothat,incaseofanavalancheofvisits,itdoesn’tconsumesomanyresourcesandnotcauseanerror503.[AlsoRead–OptimizeWordPress–RepairCorruptedTables] LogintoGoogleSearchConsoleandselectyourwebsite. Next,clickthegeariconandselectsitesettingsasshownbelow: Onthenextscreen,adjusttheGooglecrawlratebydraggingtheslidertotheleftside: LimitWordPressHeartbeat It’sresponsibleforfeaturessuchaspostautosavingandsoon. TheWordPressHeartbeatAPIfiresafileknownasadmin-ajax.phpamongotherqueriesatregularintervalswhenyou’reloggedintoyoursite.TodetermineifWordPressHeartbeatisthecauseofthe503serviceunavailableerroronyourWordPresssite,addthefollowingcodeintoyourtheme’sfunctions.phpfilerightaftertheopening
延伸文章資訊
- 1How to Fix the 503 Error in WordPress - DreamHost
A 503 Service Unavailable Error typically means your web server ran out of the resources it needs...
- 2如何修復在WordPress 當中「503 Service Unavailable Error ...
當我們在使用WordPress 的時候,有時不小心會遇到網站顯示「503 Service Unavailable Error」的錯誤,接著無法正常瀏覽網站了。
- 3How to fix 503 Service Unavailable Error in WordPress (2022)
How To Fix 503 Service Unavailable Errors When Using WordPress (Hint: It Means Your Website Is Ex...
- 4HTTP Error 503 Service Unavailable Explained - freeCodeCamp
- 5How To Fix Google Chrome Error 503 - Solvusoft