The index.php
file in my WordPress installation directory seems to run several other scripts in order to properly configure the WordPress Environment, and in turn, these scripts define several constants. My question is: does that procedure of running the initialization scripts and defining constants happens every time a requests hits the server, or does it happens only after the first request to the server and these environment constants and settings remain defined until the server is shutdown?
Leave a Reply
You must be logged in to post a comment.
In WordPress (and PHP in general), each request runs in its own environment, that is isolated from other requests and does not share any constants, variables or loaded classes with other requests. Each request starts with a “clean slate” and has to do all initialization work from new. When the request finishes, all data loaded/created by the request is destroyed.
There are some exceptions to the “total isolation of requests” rule: