Oh dear, your application has suddenly stopped working as expected. What should you do now?
Using techniques applicable to any php application, we'll go over what to look for and which problems to avoid when trying to determine where the problem lies. We'll show how to correctly identify and deal with problems including:
* network connectivity
* server config issues
* php config
* WSOD
* common CakePHP application errors
16. PHP CONFIG
Inifile settings are the defaults if notchanged (duh)
display_errors(On/Off)
log_errors(On)
display_startup_errors(Off)
error_reporting(On/Off)
Runtime settings override the inifile -no effectif the file theyare
in has aparse error (duh)
ini_set('display_errors', 0/1)
19. A WAY TO REPRODUCE
Have awayto consistentlyreproduce the error
$curl-Ihttp://example.dev/
HTTP/1.1500InternalServerError
Server:nginx
Date:Sat,23Aug201410:33:46GMT
Content-Type:text/html
gitbisect-find regression errors quickly
27. NAMESERVER PROBLEMS
No response from nameservers is the same as adomain not
existsing
$digcakefest.org
;<<>>DiG9.8.3-P1<<>>cakefest.org
;;globaloptions:+cmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:SERVFAIL,id:15266
;;flags:qrrdra;QUERY:1,ANSWER:0,AUTHORITY:0,ADDITIONAL:0
;;QUESTIONSECTION:
;cakefest.org. IN A
;;Querytime:4142msec
;;SERVER:8.8.8.8#53(8.8.8.8)
;;WHEN:TueAug1916:26:592014
;;MSGSIZE rcvd:30
...
;;ANSWERSECTION:
cakefest.org. 1568 IN A 50.56.232.22
...
28. DNS PROBLEMS
"No route to host"means the ip requested isn'taccessible
$traceroutecakefest.org
traceroutetocakefest.org(50.56.232.22),64hopsmax,52bytepackets
1 172.26.81.1(172.26.81.1) 1.032ms 0.912ms 0.912ms
2 192.168.0.1(192.168.0.1) 2.777ms 1.267ms 2.338ms
...
12 rackspace-ic-302090-dls-bb1.c.telia.net(62.115.33.78) 152.340ms 15
9.367ms 146.339ms
13 ***
14 ***
15 ***
If there are stars -there be problems
29. BACKEND SERVER IS
DOWN
502 Bad Gateway
E.g. php-fpm or hhvm is notrunning
Willbe in the webserver error log
There willnotbe anyapplication logentries
31. FIX PROBLEMS, NOT SYMPTOMS
Don'tignore errors/warnings/notices
Fix them in order, some errors willbe the concequence of earlier
problems.
32. COMMON MISTAKES
Notlookingfor error logs
Readingor focussingon the wrongerror message
Notreadingthe error message
Notreadingthe error message aloud
Misinterprettingthe error message
Stoppingdebuggingtoo early.
If "the problem"is aclass/function with source code -debug the
source code of thatfunction
New user: Ifound the problem, it's
app/webroot/index.php!
33. IMPLICIT ASSUMPTIONS
Be waryof implictassumptions
You're debuggingthe same file the browser is loading
You're debuggingthe same application the browser is loading
You're debuggingthe same server the browser is loading
You're debuggingthe same requestthe browser is loading
Conclusions so far are accurate
WTF?Backup, and re-verifyeverything.
38. CAN'T FIX IT
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
Can'tfind the problem/solution?-gethelp. Butfirst:
Collectthe information you've got
Write astandalone, reproducible example if possible
Reduce the question to it's simplest, form
Don'tover simplifyor make acontrived example
Ask colleagues/the internet
Brace for impact
Stack overflow, the google group and irc as greatplaces to get
help