PHP Remote Interpreters Support in PhpStorm 8 EAP
Support for PHP remote interpreters has been introduced in PhpStorm 8 EAP. It lets us use a PHP interpreter over SSH installed on any remote environment, to run/debug application and run testing tools remotely.
Using a remote interpreter instead of a local one gives us an opportunity to get advantages of a PHP interpreter installed in a production-like environment (be it a physical server, a virtualized environment such as Vagrant, or any other). That way we can make sure there will be no inconsistencies when the application is finally deployed to production.
In this blog post we will look into configuring and using PHP remote interpreters for PHPUnit.
PHP Remote Interpreters Configuration
A remote interpreter can be configured in the same way as a local one in Settings | PHP | Interpreter | …
All the current PHP interpreters will be listed. Click the + button to add a new one, then select Remote to add a new remote interpreter.
The PHP remote interpreter dialog displays:
A PHP remote interpreter can be configured:
- Manually – all the SSH connection details should be provided in the dialog (Host, Port, User name, Auth type, Password, etc);
- From the deployment server configuration – after selecting a deployment server, all the connection details will be filled in by PhpStorm from deployment server settings. Please note that SFTP deployment with valid mappings should be configured first in Settings | Deployment to have the button Fill from deployment server settings available.
- From the Vagrant configuration – after selecting Vagrant Configuration Folder, all the connection details will be filled in by PhpStorm from the current Vagrant configuration.
After you click OK, the connection will be tested and (in case of success) the remote interpreter will be added to the list of PHP interpreters in PhpStorm.
Please note that a valid deployment server with correct mappings should be configured in any case so that PhpStorm knows what file should be executed on the remote environment.
PHPUnit via SSH
One of the most important use cases for PHP remote interpreters is running PHPUnit tests remotely, and now it’s already possible.
In order to configure a running PHPUnit remotely, just add a new PHPUnit Setting by Remote Interpreter in Settings | PHP | PHPUnit.
Select the appropriate remote interpreter in the dialog to proceed:
The PHPUnit configuration will be added, and the usual PHPUnit testing workflow will be valid (with PHPUnit configuration through run/debug configurations dialog).
Please note that PHPUnit configuration will be used according to the default PHP interpreter setting for the project. The same PHPUnit configuration can be used for working with local and remote interpreter, it will rely on the default PHP interpreter setting in the project.
Develop with pleasure!
-JetBrains PhpStorm Team
Subscribe to Blog updates
Thanks, we've got you!
PhpStorm 2023.2 Beta
In this build, we’ve added new inspections for PHP assertions and revised the integration with third-party quality tools.
PhpStorm 2023.2 EAP #6
This build brings improvements for generating PHPDocs, support for Laravel Pint, a single point of access to all PHP framework plugins, and much more!
AI Features in PhpStorm: PhpStorm 2023.2 EAP #5
The next EAP build for PhpStorm 2023.2 is now available, and it’s an exciting one! It is the first build to include features leveraging the enormous potential of generative AI and large language models (LLMs). Our Early Access Program (EAP) allows you to try new features from the upcoming PhpStor…
PhpStorm 2023.2 EAP #4
This build includes a bunch of usability improvements, such as abilities to pin Run configurations and sort files by modification time in the Project view. The EAP allows you to try new features from the upcoming PhpStorm version, 2023.2. EAP builds are free to use and you can install them side b…