PHP Include Paths

The PHP Include Path is a set of locations that is used for finding resources referenced by include/require statements.

Elements added to a project's Include Path affect the following:

  • Running/Debugging /Profiling - Files that are called with a 'relative path' will be searched for during runtime in the resources and order specified in the include path.

  • Go to source / content assist for include statements - Files that are called with a relative path'' will be searched for according to the resources and order specified in the project's include path.

  • Organizing Includes - If a 'require'/'include' call calls a file that exists outside of the active project and its location is specified in a 'Relative' way (see below), you must add its location to the project's Include Path in order for the correct file to be included.

  • Content Assist - Adding projects/libraries to a project's Include Path will make elements defined within the included projects/libraries available as Content Assist options to the project.


In 'include'/'require' calls, file locations can be defined in three ways:

  1. Absolute Path- The exact file location is specified (e.g. C:\Documents and Settings\MyProject\myfolder\a.php). During Remote PHP Script (PHP Server) or PHP Web Page Running/Debugging /Profiling when the 'Local Copy' option is selected under the 'Source Location' category in the Advanced tab, the Path Mapping mechanism will be activated.

  2. Relative to the Current Working Directory - File names preceded with a "./" or a "../" These will only be searched for relative to the PHP 'Current Working Directory'. You can find out the location of your Current Working Directory by running the command "echo getcwd()".

  3. Relative Path - Only the file name or partial path is specified (e.g. /myfolder/a.php). In this case, Zend Studio will search for the file's path according to the resources and order configured in the project's Include Path.
    If the path of the file being searched for exists in more than one location, the file that is called will be the first one Zend Studio encounters during the search process.
    By default, the order in which Zend Studio searches for the file's path is as follows:

    1. Projects in the "debug target" (the first file to be debugged) project's Include Path, according to the order in which they are listed. If a project specified in the Include Path refers to other projects/libraries in its own Include Path, the file path will be searched for there before the search process continues.

    2. The "debug target" file's project.

See for more on PHP's search mechanism.