Path Mapping

Zend Studio enables you to map server paths to local paths while Debugging and Profiling on a server. Once a Path Map has been defined, if a file is called from the defined location on the server during debugging/profiling, its content will be taken from the set corresponding location on the file system/workspace.

Note:

Path Mapping is only activated during Remote PHP Script (PHP Server) Debugging/Profiling, or PHP Web Page Debugging /Profiling when the 'Local Copy' option is selected under the 'Source Location' category in the Advanced tab .

 

 

Usage Example

Example:

The server path 'C:\Documents and Settings\MyProject' has been mapped to '/MyProject' in the Workspace:

Path Mapping Server Settings

During Remote PHP Script Debugging , a file is called from location 'C:\Documents and Settings\MyProject\a.php':

The file content for a.php will be taken from the a.php file located in the 'MyProject' project, situated on the Workspace.

Note:

Server Path Maps can be viewed and defined in the Path Mapping tab of the PHP Servers Preferences page.

Defining Path Maps

Path Maps can be defined in three ways:

  1. Manually, through the PHP Servers view, PHP Servers Preferences page or the Importing a Zend Server Event File wizard. See Managing Path Maps for more information.

  2. Automatically whenever a file is debugged /profiled - A Path Map is automatically set between the path to the debug target's parent project (the parent project of the file from which the debugging process has been launched - e.g. C:\Workspace\MyProject) and the debug target's project in the Workspace (e.g. MyProject).

  3. Through the Path Mapping dialog. This is launched during debugging /profiling whenever a file defined with an absolute path (See Include Paths for more on absolute file locations) is called .
    In this scenario, a Path Mapping dialog will appear with a list of 'similar files' to the one being called.
    'Similar' files are files with the same name as the called file that are situated in the following locations:

    • Files in the project from which the file was called.

    • Files in projects that are in the Include Paths of the project from which the file was called.

    • Files that are open in a Zend Studio editor.

Note:

If the debug/profile session was triggered from the Zend Debugger Toolbar, all files in the Workspace with the same name will be listed.

Path Mapping file options Dialog

Note:

The dialog will not appear if a Path Mapping to the called location has already been defined.

Selecting a file from the list results in a Path Map being created between the called remote file's parent folder and the parent folder of the 'similar' file selected from the list. This means that every time a file is called from the same parent folder, its content will be taken from the file situated in the selected Workspace/local folder .

If none of the options in the Matching items list represent your desired file location, you may select the 'Get content from the server for the following path' option. This means that whenever this path is called during the debugging/profiling process, it will only be searched for on the server. (This is done using PHP's search mechanism - see http://il2.php.net/manual/en/function.include.php for more information.)
You can click Configure to modify the path to include any parent or child directories.

Note:

Selecting the 'Get content from the server for the following path' option will only affect the current Debug / Profile session. No Path Mapping will be defined.