Configure PHP Remote Interpreter Dialog
The dialog is available only when the PHP Remote Interpreter plugin is enabled. The PHP Remote Interpreter plugin is bundled with PhpStorm and activated by default. If the plugin is disabled, enable it on the Installed tab of the Settings/Preferences | Plugins page, as described in Managing plugins.
The dialog opens when you click Add in the left-hand pane of the CLI Interpreters dialog and choose From Docker, Vagrant, VM, WSL, Remote from the popup menu.
Use this dialog to configure access to PHP engines installed on remote hosts or in development environments set up in Vagrant or Docker instances.
Choose this option to configure access to a PHP interpreter on a remote host through SSH credentials. From the SSH configuration list, choose one of the created SSH configurations, or click and create a new configuration as described in Create SSH configurations.
To use an interpreter configuration, you need path mappings that set correspondence between the project folders, the folders on the server to copy project files to, and the URL addresses to access the copied data on the server. PhpStorm first attempts to retrieve path mappings itself by processing all the available application-level configurations. If PhpStorm finds the configurations with the same host as the one specified in the selected SSH configuration, the mappings from these configurations are merged automatically. If no configurations with this host are found, PhpStorm displays an error message informing you that path mappings are not configured.
To fix the problem, open the Deployment page under the Build, Execution, Deployment node, select the server access configuration, switch to the Mappings tab, and map local folders to folders on the server as described in Create a remote server configuration, section Mapping Local Folders to Folders on the Server and the URL Addresses to Access Them .
This option is available only when the PHP Docker and Docker Integration plugins are enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Installed tab of the Plugins page as described in Manage plugins.
Choose this option to configure access to a PHP interpreter running in a Docker container. In the fields of the dialog, specify the following:
In the Server field, specify the Docker configuration to use, see Configure the Docker daemon connection settings for details. Select a configuration from the list or click New. and create a new configuration on the Docker page that opens.
In the Image name field, specify the base Docker image to use. Choose one of the previously downloaded or your custom images from the list or type the image name manually, for example, php:latest or php:7.0-cli . When you later launch the run configuration, Docker will search for the specified image on your machine. If the search fails, the image will be downloaded from the Docker Official Images repository on the Docker Registry page.
This option is available only when the PHP Docker and Docker Integration plugins are enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Installed tab of the Plugins page as described in Manage plugins.
This functionality requires docker-compose version 1.18.0 or later.
Choose this option to configure access to a PHP interpreter running in a Docker container in a multi-container application. In the fields of the dialog, specify the following:
In the Server field, specify the Docker configuration to use, see Configure the Docker daemon connection settings for details. Select a configuration from the list or click New. and create a new configuration on the Docker page that opens.
In the Configuration file(s) field, specify the docker-compose.yml file defining the application’s services.
In the Service field, choose the desired application’s service.
Optionally, in the Environment variables field, define the environment variables. See Docker run configuration settings for details.
In this field, specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.
For remote hosts, PhpStorm by default suggests the /usr/bin/php location.
For Vagrant instances, PhpStorm by default suggests the /usr/bin/php location.
For Docker containers, PhpStorm by default suggests the php location.
To specify a different folder, click and choose the relevant folder in the dialog that opens. Note that the PHP home directory must be open for editing.
When you click OK , PhpStorm checks whether the PHP executable is actually stored in the specified folder.
If no PHP executable is found, PhpStorm displays an error message asking you whether to continue searching or save the interpreter configuration anyway.
If the PHP executable is found, you return to the Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
This option is available only when the Vagrant repository plugin is installed and enabled. The Vagrant plugin is not bundled with PhpStorm, but it can be installed on the Settings/Preferences | Plugins page, tab Marketplace , as described in Installing plugins from JetBrains repository.
Choose this option to configure access to a PHP interpreter installed in a Vagrant instance using your Vagrant credentials. Technically, it is the folder where the VagrantFile configuration file for the desired environment is located. Based on this setting, PhpStorm detects the Vagrant host and shows it as a link in the Vagrant Host URL read-only field.
To use an interpreter configuration, you need path mappings that set correspondence between the project folders, the folders on the server to copy project files to, and the URL addresses to access the copied data on the server. PhpStorm evaluates path mappings from the VagrantFile configuration file.
Источник
Phpstorm php interpreter linux
The page and all the pages under this node are available only when the PHP plugin is enabled. The PHP plugin is bundled with PhpStorm and activated by default. If the plugin is disabled, enable it on the Installed tab of the Settings/Preferences | Plugins page, as described in Managing plugins.
Use this page to configure PHP development and unit testing support in the project by choosing one of the available PHP interpreters, see Configure local PHP interpreters and Configure remote PHP interpreters.
In this list, specify the PHP functionality scope to get coding assistance for. Each functionality scope is associated with the PHP version that supports this functionality. Currently PHP 5.3 , PHP 5.4 , PHP 5.5 , PHP 5.6 , PHP 7 , PHP 7.1 , PHP 7.2 , PHP 7.3 , PHP 7.4 , and PHP 8.0 levels are supported. See supported PHP versions for details.
No correlation between the PHP version used in the project and the language level is enforced. Although the language version of each interpreter is detected automatically, you can still tell PhpStorm to provide you with coding assistance that corresponds to a different language level. However, if you attempt to use a code construct that is not supported by the specified language level, PhpStorm suggests a Switch to PHP quick-fix.
When you open an existing project, PhpStorm analyzes it for the language features used and sets the appropriate language level automatically.
You can also set the PHP language level directly from the status bar.
The list is inactive when the PHP language version is constrained in composer.json and settings synchronization with composer.json is enabled on the Composer page of the Settings/Preferences dialog Ctrl+Alt+S .
In this list, choose the PHP interpreter to use in the current project by default. The list contains all the currently configured local and remote PHP interpreters. See Configure local PHP interpreters and Configure remote PHP interpreters for details.
Click this button next to the CLI Interpreter list to create a new PhpStorm-wide PHP installation configuration in the CLI Interpreters dialog that opens.
When you configure a remote interpreter accessible through SFTP, Vagrant, Docker, or WSL this read-only field shows the path mappings retrieved from the corresponding deployment configuration, Vagrantfile , or Dockerfile . These mappings are read-only.
To provide the custom mappings, click next to the field and specify them in the Edit Project Path Mappings dialog that opens:
- To add a custom mapping, click and specify the path in the project and the corresponding path on the remote runtime environment in the Local Path and Remote Path fields respectively. Type the paths manually or click and select the relevant files or folders in the dialog that opens.
- To remove a custom mapping, select it in the list and click .
Include Path Tab
The area displays the list of configured include paths . Include paths are used for holding third-party code that is used for completion and reference resolution in some functions/methods that use file paths as arguments, for example, require() or include() .
Use and to add and remove paths.
Use and to reorder the items in the list.
Click to sort the paths alphabetically in the ascending order.
PHP Runtime Tab
The area lists the available PHP stubs, which are normal, syntactically correct PHP files containing annotated function, method, and class signatures, constant definitions, and so on. PHP stubs are added to PhpStorm’s internal knowledge to enhance coding assistance for all the Standard PHP Library components as well as for common extensions.
Use the checkboxes next to each item to enable/disable the corresponding stub.
To load the set of stubs that matches the set of loaded extensions for the currently configured CLI interpreter, click the Sync Extensions with Interpreter button. For details on configuring interpreters, see Configure local PHP interpreters and Configure remote PHP interpreters.
In the Project tool window, the currently loaded stubs are displayed under the External Libraries node.
PHP stubs are open-source, and you can contribute to their development. See the blog post for details.
Advanced Settings Area
If necessary, you can load a set of custom PHP stubs to be used by PhpStorm. Click next to the Default stubs path field and provide the stubs folder location in the dialog that opens. This way, you can loaPhpStormonal stubs as well as override the bundled ones.
PHP stubs are available as a Composer package, and can thus be declared and installed as a dependency for some third-party package. In this case, they are stored under the vendor/jetbrains/phpstorm-stubs folder inside your project.
To prevent conflicts between the Composer package stubs and PhpStorm bundled stubs, do one of the following:
To use the Composer package stubs in your project, explicitly provide the path to their location in the Default stubs path field.
To use the PhpStorm’s bundled PHP stubs, make sure that the Default stubs path field is cleared and the vendor/jetbrains/phpstorm-stubs folder is excluded from the project.
If the Add packages as libraries option is enabled on the PHP | Composer page of the Settings/Preferences dialog Ctrl+Alt+S , PhpStorm automatically marks the vendor/jetbrains/phpstorm-stubs folder as excluded. By default, the option is enabled.
If the Add packages as libraries is disabled, you can exclude the stubs package folder manually. To do this, in the Project view, right-click the vendor/jetbrains/phpstorm-stubs folder and select Mark Directory as | Excluded from the context menu.
For details in working with Composer in PhpStorm, refer to Composer dependency manager.
Analysis Tab
Use this tab to configure the behavior of certain PhpStorm inspections.
Exception Analysis
Use this section to configure exception analysis, which alters the behavior of the Unhandled exception , Redundant catch clause , Missing @throws tag(s) , and Redundant @throws tag(s) inspections.
Use this list to set the desired exception analysis depth level. By default, 1 is selected, in which case PhpStorm reports the unhandled exceptions for the parent method throwing an exception, as well as the methods directly calling it. Selecting larger values allows you to drill down deeper into the calls hierarchy.
If 0 is selected, the exception analysis is limited to the parent method.
Values greater than 1 might negatively affect the IDE’s performance.
Select this checkbox to have PhpStorm skip certain method calls in the instance creation expressions during exception analysis:
Method calls only having strings or constants as parameters are skipped:
Method calls having variables, integers, arrays, and so on as parameters are not skipped:
Custom Format Functions
Use this section to include your custom string formatting functions into the Format function parameters mismatch inspection analysis scope. This inspection reports the mismatches between format function parameters and specification conversion entries and by default analyzes the usages of the standard PHP printf and sprintf functions.
Click this button to add a new function record to the custom format functions list. In the Add Custom Format Function dialog that opens, provide the name of a class method or function and specify the index of the argument where your formatting template resides.
Click this button to remove a function record from the custom format functions list.
Click this button to edit the selected function record.
Include Analysis
Use this section to define a custom folder the $_SERVER[‘DOCUMENT_ROOT’] expression should resolve to, which alters the behavior of the Unresolved include inspection.
The specified path will be used in code completion for the functions/methods that use file paths as arguments (for example, require() or include() ). If the path is left blank, code completion will suggest the paths relative to the project root.
Commonly, this setting should be modified in case the document root folder defined by your web server configuration is different from the PhpStorm project root folder.
Item | Description |
---|---|
$_SERVER[‘DOCUMENT_ROOT’ |