In addition to everything that has already been said, I propose to centralize all common functions. Create a file, for example common.php, and all this includes the application you need, and then include it from all your scripts.
In addition, a good way to make relative involves using the dirname()
function in conjunction with the __FILE__
magic constant. For instance:
require_once dirname(__FILE__) . '/../lib/common.php';
source share