- Phpstorm Virtualbox Xdebug
- Phpstorm Vagrant Virtualbox
- Phpstorm Virtualbox Download
- Phpstorm Virtualbox Windows 10
- Phpstorm Virtualbox Docker
VirtualBox allows you to use VirtualBox’s virtualization to provide a clean build environment for every build. This executor supports all systems that can be run on VirtualBox. The only requirement is that the virtual machine exposes its SSH server and provide a bash-compatible shell. I have seen this in phpstorm in Virtualbox 5.1.2 on a linux client. Actually the behaviour was gone after one update, but yesterday it mystically just came back. Comment:33 Changed 5 years ago by chiller but now its gone after a reboot of the VM. It probably happens sometimes whenever i save the state of the VM and later recover it. In diesem Teil der Vbox-Serie zeige ich, wie ihr die PHP Webapp, die in der Vbox gehosted ist, mit PhpStorm integriert. Links zur Vbox: - https://github.com/.
Introduction
This article will show you how to set up a virtual machine for a local Shopware 6 environment in development mode. Some of you might stumbled upon the restrictions of Shopware when it comes to Windows as operating system. Everyone that might have tried to get shopware working on Windows might know, that it is more likely to fail than to succeed. It is important to use a Unix-based system (like Linux or MacOS) as environment for a local setup. Surely not everyone is that familiar with Linux or has an Apple product to work with. This guide will help you to set up a Linux virtual machine on your local operating system regardless with OS you are currently using.
First of all you will need a local installation of Virtual Box from Oracle. Just download it from https://www.oracle.com/de/index.html and start the installation process. The main reason for a virtual box image is, that you can use it independently on every operating system you are using - even if you change e.g. from Windows to MacOS in the future. Since the settings are saved inside the virtual image, a re-installation of your laptop will keep the configuration and you are ready to go in a few steps after the installation of virtual box.
Downloading Ubuntu
This guide will focus on Ubuntu and use it as a foundation for the setup. Ubuntu is a well known and documented Linux distribution and might be the best choice for beginners. Since we won’t need the whole Desktop-Manager version of Ubuntu, just grab the network installer image from their site: https://ubuntu.com/download/alternative-downloads
Just wait until the download finishes and we will start with the configuration of the virtual box.
Creating a Virtual Box Image
First of all, you need to start your newly installed Virtual Box. Just create a new virtual machine by using the „new“ button on the right side of the new menu or use the top menu (Machine -> New).
Further you need to define what operating system you want to virtualize and have to Select „Type: Linux“ and „Version: Ubuntu“ in the sub-menu. Feel free to choose any name you want for the newly created virtual box image.
You can confirm your selection with „continue“.
The next context menu will ask you about the preferred memory size, we recommend using 2GB or more for your environment, but it highly depends on your available resources on your computer (e.g. if you have only 4gb of RAM, you won’t be able to add more than 2GB to the virtual machine). In our case we will use „2048MB“ as selection. Confirm to go to the next step.
Now you need to define your hard disk for the virtual machine - just keep the selection at „Create a virtual hard disk now“ and use the „create“ button to confirm this.
Inside this new sub-menu you can keep the selection at „VDI (VirtualBox Disk Image“) and go on with continue. The new image should be „Dynamically Allocated“ in our case and 15-20GB should be enough for the local environment. The steps will show you comprehensive information on what to do. After you have finished the configuration of your VM, you will be back at the start screen from above.
Before we will start our newly created virtual box, we need to do some additional configuration. Just select the newly created VM and open the „Settings“ menu. Change to the „Network“ configuration and open the hidden „advanced“ configuration. In this section you will find the „Port Forwarding“ - just click this button for a new sub-menu.
Add the configuration from the screenshot in order to make your VM available from your local computer on localhost. If you need to change this ports, please keep those changes in mind, because we need them later on. Often there are already services listening to port 22 and 80 on your local computer, so we changed the host ports to unused ones. Confirm your selection and close the sub-menues.
Environment Setup
Ubuntu Setup
Just start your newly created virtual machine in the main menu of virtual box. Since the virtual environment is empty for now, you will need to add your downloaded iso file of Ubuntu in the menu. Just select it from your hard drive and hit the start button.
The system will boot from your Ubuntu ISO and will show the boot loader with some possible selections. Start the standard installation in this case.
The Ubuntu installer will start and you are asked for your preferred language and region. After you confirm your selection the system will try to guess your keyboard layout, this can be done automatically or by choosing the right one. Either way you will use, make sure that you choose the right one. After this basic system configuration is done, the installer will establish a connection to the Ubuntu servers to download the needed packages for the installation. You will be prompted to define hostname (feel free to choose any) and a mirror (just select the pre-defined one). When using a proxy for your internet connection you can configure it as well, but in most cases you won’t need to do anything.
The next step will be the setup of the user name and password. In our case we will select „shopware“ as username and „shopware“ as password, but you are free to define a different one - but please make sure, that you will remember it. The time zone will be detected afterwards, you only need to change this, if it really differs from your current time zone.
Just choose the guided partitioning of the hard drive in the next menu and go on with the installation and write your changes to the disk. The basic installation of the software will take place. Since most of the packages will be downloaded from the Ubuntu mirrors, this will take a while depending on your internet connection. Feel free to install security updates automatically in the next step. Further on we will be asked for additional software that might needs to be installed. From this new menu choose „LAMP Server“ (Apache, MySQL, PHP) and „OpenSSH server“ (the selection can be done by hitting the space bar). The process will install the newly choosen software and the bootloader (you may need to confirm this too). Finish the installation and we are ready to do some additional configuration of the system.
Ubuntu Configuration
Remove the Ubuntu ISO from the VM (by clicking the small CD-ROM symbol at the bottom of the VM window) and shut down your newly created virtual image. Start it again while holding the „Shift“-key. This will start the VM in the background and we are able to access it via SSH. On most environments this is possible via a terminal with the command „ssh shopware@127.0.0.1 -p2222“. Please make sure to add your newly created user instead of „shopware“ if it differs. On Windows environments software like Putty is used for SSH connections, but you can use the VM window too, if you don’t want to use an additional software.
First of all, you can check your installation. Just open 127.0.0.1:8080 (keep in mind, that you might have changed this port) - an Apache test page should be visible in your browser. Inside the terminal you can verify the installation of PHP by using „php -v“ and it will show you the used PHP version (it should be 7.2 at least).
We will need to set a password for MySQL - you can do this with the following commands:
In our case we will set the password of the user „root“ to „root“. You may want to change this, but keep in mind to remember this password at a later time.
Installation of dependencies
In order to use Shopware, you will need to install some additional dependencies on your local machine. This can be done by the following commands:
After the installation make sure, that you use a current version of npm by ececuting this:
Installation of Virtual Box guest additions
For a smooth integration of virtual box on your computer, we recommend adding the guest additions to your virtual machine. Just open your virtual machine (button „show“ in the virtual box main menu) and add it via the conext menu Devices -> Insert Guest Additions CD Image. After the image is inserted, you need to mount it and start the installation:
You might have to establish the SSH connection again after rebooting.
Configuration of Apache
First of all you need to activate mod-rewrite, this can be done by executing the following command in your vitual machine:
After this you will need to add a new vhost-configuration, just disable the existing one:
And at last you need to create a new configuration:
Just add the following configuration to the editor:
With CTRL + O you can save it and with CTRL + X you can leave the editor. Afterwards you need to restart the webserver:
Since Linux is a system that is really strict with right- and permission management, we need to add the user 'shopware' to the 'www-data' group, in order to prevent issues with the permissions:
You might need to restart the SSH connection after rebooting the VM.
Installation of Composer
Just keep in mind, that the verification of the installer might change, so you need to use the commands from the Composer website to make sure: https://getcomposer.org/download/
For Example:
After you have downloaded Composer sucessfully, you need to make it executable via the command „composer“, just copy it to the /bin folder:
You can verify your installation by running „composer“ in your terminal.
Installation of Shopware 6 development environment
Shopware 6 comes in two different versions. There is an official release-package for production systems, that won’t provide you any development tooling (e.g. for building plugin assets) and there is the GitHub repository that will be your development environment. Change the directory to the web folder and download shopware 6 from github:
In order to start the installation, you can simply execute the following commands, a wizard will guide you through the installation of Shopware.
You will be asked for your environment (select „dev“), your public url (in our case http://127.0.0.1:8080, the port may differ according to your configuration), your database (keep localhost, shopware as database name and root/root as user/password).
After you confirm your environment parameters, the installation will take place. It will take 37 steps to finish this installation, so you might have to wait a bit. The Composer dependencies will be downloaded at first.
For the next installation they will be taken from cache, this will speed up the installation quite a bit. When the installation is finished, you can access the installation via your browser on your local environment: http://127.0.0.1:8080. The administration is accessible with /admin and the user/password combination of admin/shopware.
Optional configuration
Reset installation
Since the master branch of Shopware 6 is updated frequently, you may want to reset your installation. This can be easily done by deleting the folder and cloning the repository once again. But you may want to have a script for that, here is an example:Add the following content to it:
Now you can re-install your whole installation by just executing the newly created script. Just make it executable and move it to the /bin folder:
Updating the master branch
In some cases you might want to keep your settings and database and just get the newest files from Github. This can be achieved by the following commands inside the Shopware 6 folder:
Feel free to create a script from it like the one we created above.
Installation of a Release-Tag
Since we already have a released version of Shopware 6 available on our download page, you might want to install this exact version instead the current master branch. You can achieve this by adding a specific parameter that points to the tag:PHPStorm configuration
You can use this setup as development environment, so you surely want to configure PHPStorm accordingly. When creating a new project in PHPStorm you can choose the option 'Create new project from existing files' from the sub menu. Just choose 'Web server is on remote host, files are accessible via FTP/SFTP/FTPS'.When going to the next step you need to add a project name and a local folder (feel free to choose anything).
In the next window you need to add your SSH/SFTP configuration of the virtual environment.
Just finish the wizard afterwards without any further configuration and the download of your project files will start. This may take a while. After the download, you are able to use this connection to develop locally on e.g. on Windows and upload your changes to the Linux virtual environment.
Visual Studio Code configuration
Visual Studio Code might be a good alternative to PHPStorm, when it comes to license costs, since it is completely free. You can add a remote host too, but you will need the 'Visual Studio Code Remote Development Extension Pack' from the extension list. Just open the extension list from the left panel and search for this extension and install it. A restart may be required. After rebooting a whole new menu will appear on the left of the Visual Studio Code menu.Create a new ssh configuration:
At first you may be promted with a new input field for the password while trying to connect:
Afterwards you can use the terminal and the file editor of Visual Studio Code to access your Shopware 6 installation and start development.
After the setup is completed Visual Studio Code will offer you an established SSH connection where you can execute commands directly in the virtual machine.
Adding the SW6 installation as network share
Since you might want to use your IDE without any SSH/SFTP Connection, you can add the folder of the Shopware 6 installation as network share from your VM on the host system. First oft all, you need to install the SMB server:After the installation the Samba server is running. We need to add our username to the server, in order to access it over network:
This will be promted by a password input, we will keep it as 'shopware' for now, since it is easy to remember and used in steps places in this guide. As next step we need to define the network share and map it to a local folder inside the virtual machine:
To finish the setup we need to restart the Samba server too.
Turn off your VM and go to the network configuration inside virtual box and open up the port-forwarding window under 'advanced configuration'.
Add the port-forwarding of TCP port 445 and map it to a local port that is not used by any other service (in our case we used 4455). After adding the port you can save the configuration and close the window. The network share is now ready to use in every operating system.
You can find a detailed documentation on how to add this network share to your local computer later in this guide.
Download the VM
We highly recommend creating your own VM in order to learn about the difficulties and challenges while using Linux, but we do offer you a ready to use VM that will be updated frequently: shopware.ovaJust use the import dialog of Virtual Box, all settings will be imported.
Shopware 6:
- Frontend: 127.0.0.1:8080
- Administration; 127.0.0.1:8080/admin
- Admin Username/Password: admin/shopware
Virtual Machine:
- SSH-Host/Port: 127.0.0.1 / Port 2222
- SSH Username/Password: shopware/shopware
- Database Username/Password: root/root
Please note, that there is already an installation inside this VM, if you want to make sure that it is the current master, please execute the command 'sw6' inside the VM the check out the newest version.
As one step of the installation process we set up a network share that you can access directly from your local computer without using any SSH/SFTP connection. This is also part of the VM. In the next steps we will show you how to use it on your local computer.
MacOS network share
Open the Finder and go the the 'Go' menu at the top. Open to 'connect to server'. Add your network share adress and port to the new window:
The next window will ask for the username and password you defined above. In our download VM it will be 'shopware' as user and 'shopware' as password.
Windows network share
Unfortunately it is not possible under Windows to map a network drive to a share in the VM under the IP 127.0.0.1. For this a few adjustments are necessary
Network adapter in Virtual Box
First change the network adapter from NAT to Bridged Adapter in the Virtual Box Manager for the Shopware VM
(It is necessary that the VM is switched off at this time)
At Settings > Network > Adapter 1 > Attached to: select Bridged Adapter
This assigns a new, own IP address to the VM through the DHCP server in the network.
(If no DHCP server is available in the network, it is necessary to manually assign an IP to the VM.)
Find out the IP assigned by DHCP
This is possible, for example, via the console displayed in the window of the VM.
To do this, type ifconfig in the console and the IP settings will be listed.
(net-tools is required for this. This is included in the prepared VM, if you have your own system you may have to install it.)
Now the connection via SSH is possible via the IP of the VM and Port 22
Customize settings in Shopware
First call the admin via http://IPoftheVM/admin
Now it is necessary to adjust the URL for the sales channel 'Storefront' in the section 'Domains' to http://IPoftheVM
After you have saved the URL change, you can directly call the frontend via IPoftheVM
Mapping the network drive
It is now possible to mount the network drive in Windows.
To do this, proceed as follows
Open 'This PC' and in the tab 'Computer' click on 'Map network drive'
In the new window choose a drive letter and enter as folder 'IPoftheVMVM' and also check 'Connect using different credentials'
Optional you can also check 'Reconnect at sign-in'
When you click on the Finish button, a window to enter the credentials is shown.
As user enter 'ubuntu/shopware' and as password 'shopware'.
(if the connection is to be re-established when logging on, it is recommended to save the login credentials)
After confirming via the OK button, the connection is now established and the network drive is connected.
The term remote PHP interpreter denotes a PHP engine installed on a remote host or in a virtual environment. The term remote PHP interpreter is used as the opposite of local PHP interpreters that are installed on your computer, see Configuring Local PHP Interpreters.
You can access a remote PHP interpreter through SSH, Docker, Docker Compose, Vagrant, or WSL:
By using SSH, you can access a PHP interpreter through the SSH access to the host where the PHP interpreter is installed.
Before you start:
Configure access to an ssh server on the target remote host and make sure this server is running.
Make sure the PHP Remote Interpreter and FTP/SFTP Connectivity plugins are enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Plugins page as described in Manage plugins.
Create an SSH configuration as described in Create SSH configurations.
Configure a PHP interpreter using SSH
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the CLI Interpreters dialog that opens, click in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote.. from the popup menu.
In the Configure Remote PHP Interpreter dialog that opens, choose the SSH method.
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, in the Settings/Preferences dialog Ctrl+Alt+S, go to PHP. Click in the Path mappings field and map local folders to the folders on the server.
- In the PHP interpreter path 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.
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 CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
In the CLI Interpreters dialog, click Show phpinfo to have PhpStorm display a separate information window with the installation details and the list of loaded extensions and configured options. Note that the additional options specified in the Configuration Options field of the PHP Interpreters dialog are not listed.
By using the Docker configuration, you can access a PHP interpreter installed in a Docker container.
Before you start:
Make sure that Docker is downloaded, installed, and configured on your computer as described in Docker.
Make sure the Docker and PHP Docker plugins are installed and enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Plugins page as described in Manage plugins.
Mac os x 10.6 snow leopard download online, free. Configure the PHP development environment in the Docker container to be used.
Learn more about using Docker with PhpStorm in Docker.
Configure a PHP interpreter in a Docker container
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the CLI Interpreters dialog that opens, click in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote.. from the popup menu.
In the Configure Remote PHP Interpreter dialog that opens, choose the Docker method.
Provide the connection parameters:
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
orphp: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.
- In the PHP interpreter path field, specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.
For Docker containers, PhpStorm by default suggests the php location.
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 CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
In the CLI Interpreters dialog, click Show phpinfo to have PhpStorm display a separate information window with the installation details and the list of loaded extensions and configured options. Note that the additional options specified in the Configuration Options field of the PHP Interpreters dialog are not listed.
By using the Docker Compose configuration, you can access a PHP interpreter running in a multi-container Docker Compose environment.
This functionality requires docker-compose version 1.18.0 or later.
Phpstorm Virtualbox Xdebug
Before you start:
Make sure that Docker is downloaded, installed, and configured on your computer as described in Docker.
Make sure the Docker and PHP Docker plugins are installed and enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Plugins page as described in Manage plugins.
Configure the PHP development environment in the Docker container to be used.
Learn more about using Docker Compose with PhpStorm in Using Docker Compose.
Phpstorm Vagrant Virtualbox
Configure a PHP interpreter using Docker Compose
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the CLI Interpreters dialog that opens, click in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote.. from the popup menu.
In the Configure Remote PHP Interpreter dialog that opens, choose the Docker Compose method.
Provide the connection parameters:
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 configuration files to use. The base configuration file located in the project root is selected by default. To select a different file or several files, click and select the desired configuration file in the Docker Compose Configuration Files dialog that opens.
From the Service list, choose the service corresponding to the container the PHP development environment is set up in.
If necessary, in the Environment Variables field, provide the environment variables. See Using Environment Variables for details.
- In the PHP interpreter path field, specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.
For Docker containers, PhpStorm by default suggests the php location.
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 CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
In the CLI Interpreters dialog, click Show phpinfo to have PhpStorm display a separate information window with the installation details and the list of loaded extensions and configured options. Note that the additional options specified in the Configuration Options field of the PHP Interpreters dialog are not listed.
- In the Lifecycle area of the CLI Interpreters dialog, choose how the Docker container for the selected service should be managed by PhpStorm.
Always start a new container ('docker-compose run'): choose this option to have the container started via the run command. The container will be restarted upon each run.
Connect to existing container ('docker-compose exec'): choose this option to have the container started once, and then connect to it via the exec command.
By using the Vagrant configuration, you can access a PHP interpreter installed on the corresponding Vagrant instance.
Before you start:
Make sure that Vagrant and Oracle's VirtualBox are downloaded, installed, and configured on your computer as described in Vagrant: Working with Reproducible Development Environments.
Make sure the Vagrant bundled plugin is enabled in the Installed tab of the Settings/Preferences | Plugins page as described in Managing plugins.
- Make sure that the parent folders of the following executable files are added to the system PATH variable:
vagrant.bat or vagrant from your Vagrant installation. This should be done automatically by the Vagrant installer.
VBoxManage.exe or VBoxManage from your Oracle's VirtualBox installation.
Configure the PHP development environment in the Vagrant instance to be used.
Learn more about using Vagrant with PhpStorm in Vagrant: Working with Reproducible Development Environments.
Configure a PHP interpreter in a Vagrant instance
In the Settings/Preferences dialog Ctrl+Alt+S, select PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the CLI Interpreters dialog that opens, click in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote.. from the popup menu.
In the Configure Remote PHP Interpreter dialog that opens, choose the Vagrant method. Mkvmerge gui download mac.
Provide the connection parameters:
Specify the Vagrant instance folder which points at the environment you are going to use. 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.
- In the PHP interpreter path field, specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.
For Vagrant instances, PhpStorm by default suggests the /usr/bin/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 CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
In the CLI Interpreters dialog, click Show phpinfo to have PhpStorm display a separate information window with the installation details and the list of loaded extensions and configured options. Note that the additional options specified in the Configuration Options field of the PHP Interpreters dialog are not listed.
By using WSL, you can access a PHP interpreter installed in a Linux environment through the Windows Subsystem for Linux compatibility layer.
Before you start, make sure the following prerequisites are met:
Phpstorm Virtualbox Download
On your Windows 10 machine, make sure the WSL feature is enabled, and the preferred Linux distribution is installed. Refer to the Windows Subsystem for Linux Installation Guide for Windows 10 for details.
Inside the Linux installation, make sure PHP is installed. For the detailed installation instructions, refer to Debian GNU/Linux installation notes. If you are using Ubuntu, you can run this command in the Terminal to quickly install PHP:
sudo apt install php php-mbstring php-dom php-xml php-zip php-curl php-xdebug
Configure a PHP interpreter using WSL
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the CLI Interpreters dialog that opens, click in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote.. from the popup menu.
In the Configure Remote PHP Interpreter dialog that opens, choose the WSL method.
From the Linux distribution list, choose one of the installed Linux distributions to use.
- In the PHP interpreter path field, specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.
For WSL, PhpStorm by default suggests /usr/local/bin/php.
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 CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.
In the CLI Interpreters dialog, click Show phpinfo to have PhpStorm display a separate information window with the installation details and the list of loaded extensions and configured options. Note that the additional options specified in the Configuration Options field of the PHP Interpreters dialog are not listed.
Provide additional configuration options
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
On the PHP page that opens, click next to the CLI Interpreter list.
In the Additional area of the CLI Interpreters dialog, you can optionally customize the configuration settings of the PHP installation.
In the Debugger extension field, specify the path to Xdebug. This enables PhpStorm to activate Xdebug when it is necessary if you have disabled it in the php.ini file, see Configuring Xdebug for Using in the On-Demand Mode.
In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the php.ini file. The directives specified in this field override the default directives generated by PhpStorm, such as
-dxdebug.remote_enable=1
,-dxdebug.remote_host=127.0.0.1
,-dxdebug.remote_port=9001
,-dxdebug.remote_mode=req
.For example, if you specify the
-dxdebug.remote_mode=jit
directive it will override the default-dxdebug.remote_mode=req
directive and thus switch Xdebug to the Just-In-Time (JIT) mode, see Debug in the Just-In-Time mode for details.To do that, click next to the Configuration options field, and then create a list of entries in the Configuration Options dialog that opens.
- To add a new entry, click . In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value fields respectively.
You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.
To delete an entry, select it in the list and click .
To change the order of entries, click or .
Upon clicking OK, you return to the CLI Interpreters dialog, where the entries are transformed into a command line.
- To add a new entry, click . In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value fields respectively.
Configure custom mappings
If you use an interpreter accessible through SSH connection or located on a Vagrant instance or in a Docker container, the mappings are automatically retrieved from the corresponding deployment configuration, Vagrantfile, or Dockerfile.
In the Settings/Preferences dialog Ctrl+Alt+S, go to PHP.
From the Interpreter list, choose the remote interpreter for which you want to customize the mappings. The Path Mappings read-only field shows the path mappings retrieved from the corresponding deployment configuration, Vagrantfile, or Dockerfile. To specify the custom mappings, click next to the Path Mappings field.
The Edit Project Path Mappings dialog shows the path mappings retrieved from the deployment configuration, Vagrantfile, or Dockerfile. These mappings are read-only.
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 .
Switch between configured PHP interpreters on the fly
Phpstorm Virtualbox Windows 10
Press Ctrl+Shift+A and start typing
Change PHP interpreter
. In the suggestions list, select the Change PHP interpreter action.If necessary, you can assign a keyboard shortcut for this action either directly in the suggestions list by pressing Alt+Enter, or at a later point as described in Configure keyboard shortcuts.
In the popup menu that opens, select one of the configured local or remote PHP interpreters.
Phpstorm Virtualbox Docker
The selected interpreter will be set as the default project interpreter on the PHP page of the Settings/Preferences dialog Ctrl+Alt+S. This will also affect the run/debug configurations, test frameworks', and quality tools' configurations that are set to use the default project interpreter.