The dwelling for that current project I'm focusing on is one thing like:

  • root/index.php
  • root/includes/php/first.php
  • root/includes/php/functions.php

So index.php includes first.php:

<?php include_once("includes/php/first.php"); ?>

Normally then my first.php would call functions like:

<?php include_once("includes/php/functions.php"); ?>

Presuming the relative would be in the index page however, if moving to a different server it did not work. I attempted making the relative path from first.php:


Which appears to operate now.

Which may normally be the right way to get this done? I wish to roll this project out so nearly anybody would have the ability to install this.

includes are in accordance with the file doing the including. If you want to make certain and steer clear of any ambiguity, you could do this this:

include dirname(__FILE__) . "/functions.php";