Configure local PHP interpreters
A local PHP interpreter is a PHP engine installed on your computer as opposed to a remote PHP interpreter that is installed on a remote host, in a Docker container, or in a Vagrant virtual environment.
Before you start configuration of a local PHP interpreter in PhpStorm, make sure that the PHP engine is installed on your local machine.
Configure a local PHP interpreter
- Press Control+Alt+S to open the IDE settings and then 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 Local from the popup menu. If you already have a local interpreter configured in PhpStorm, then it is shown in the menu list, and the menu item changes to Other Local .
- In the right-hand pane of the dialog, specify the name and general settings for the new PHP interpreter.
- Name : type the interpreter name to distinguish it from others, for example, php_installation_ .
- PHP executable : specify the path to the PHP engine installation directory. Type it manually or click and select the relevant folder in the dialog that opens.
- Configuration file : specify the path to a custom php.ini configuration file. Use this field if you want to specify a php.ini file different from that autodetected by the IDE and displayed in the non-editable Configuration file field below. Type it manually or click and select the relevant file in the dialog that opens.
PhpStorm displays the version of the PHP engine detected in the specified folder, the debugger associated with this PHP engine in the php.ini file, and an action link to open the specified php.ini file in PhpStorm’s editor.
Clicking next to the PHP executable field opens a separate information window with the installation details and the list of loaded extensions and configured options.
- Debugger extension : specify the path to the Xdebug executable file for debugging in On-Demand Mode. This way, PhpStorm can activate Xdebug even if it has been disabled in the php.ini file.
- Configuration options : 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.mode=debug, -dxdebug.client_host=127.0.0.1, -dxdebug.client_port=9003, -dxdebug.start_upon_error=default
For example, if you specify the -dxdebug.start_upon_error=yes directive, it will override the default -dxdebug.start_upon_error=default directive and thus switch Xdebug to the Just-In-Time (JIT) mode. For more information, refer to Debug in the Just-In-Time mode.
-dxdebug.remote_enable=1, -dxdebug.remote_host=127.0.0.1, -dxdebug.remote_port=9000, -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. For more information, refer to Debug in the Just-In-Time mode.
- 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.
Switch between configured PHP interpreters on the fly
- Press Control+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 Keyboard shortcuts.
- In the popup menu that opens, select one of the configured local or remote PHP interpreters.
The selected interpreter will be set as the default project interpreter on the PHP page of the Settings dialog ( Control+Alt+S ). This will also affect configurations that use the default project interpreter (test frameworks’, quality tools’, and run/debug configurations) and commands run in the PhpStorm terminal.
Как добавить интерпретатор php в PhpStorm?


- PHP
- +1 ещё
Как из разных word документов собрать все таблицы (средствами PHPOffice/PHPWord) с заданным названием и сохранить в один файл?
- 1 подписчик
- 40 минут назад
- 21 просмотр
Как установить интерпретатор php в phpstorm

На данный момент, PhpStorm – одна из лучших IDE для разработки на языке PHP, которая предоставляет множество возможностей для разработчика, такие как запуск PHP-скриптов, благодаря возможности подключения внешнего интерпретатора PHP и отладку через расширение Xdebug.
В этой статье мы рассмотрим возможность подключения интерпретатора PHP, отладчика Xdebug к PhpStorm и использование встроенного в IDE web-сервера.
Начнем с установки отладчика Xdebug в PHP.
Установка Xdebug
Первым делом скачаем и установим сам интерпретатор PHP по ссылке: http://php.net/downloads.php
Далее нужно произвести начальную настройку PHP и прописать в переменную окружения PATH путь к интерпретатору. Чтобы не повторяться, весь необходимый порядок действий мной описан в этой статье: Установка Composer и снятие ограничения количества обращений к GitHub
Теперь можно перейти к установке отладчика Xdebug, для которого существует специальный помощник, значительно упрощающий процедуру установки. Для его использования перейдем по ссылке: https://xdebug.org/wizard.php
На этой странице, необходимо ввести в поле ввода информацию об установленном PHP-интерпретаторе, которая генерируется с помощью PHP-функции phpinfo(). Вводить нужно весь скопированный текст со страницы.
Или, введя в консоль команду php -i, которая генерирует информацию о PHP.
Копируем полученную информацию, нажимаем кнопку Analyse my phpinfo() output и получаем инструкцию по установке Xdebug.
В зависимости от вашей версии PHP и пути установки инструкция может отличаться от моей:
- Скачиваем библиотеку Xdebug для PHP версии 5.6.19 по ссылке: php_xdebug-2.4.0-5.6-vc11-nts.dll
- Перемещаем её в папку C:\php\ext
- В файл C:\php\php.ini находим секцию Dynamic Extensions и добавляем следующую строку:
zend_extension = C:\php\ext\php_xdebug-2.4.0-5.6-vc11-nts.dll
Подключение интерпретатора PHP к PhpStorm
Теперь перейдем в PhpStorm и откроем настройки комбинацией клавиш Ctrl+Alt+S.
Далее, в секции Languages & Frameworks выберем пункт PHP. В этой секции необходимо назначить интерпретатор для IDE в пункте Interpreter нажав на кнопку …

В открывшемся окне, в поле Name вводим любое имя для удобства дальнейшей идентификации, например: PHP 5.6.11.
В поле PHP executable указываем путь до интерпретатора, например: C:\php\php.exe. Обратите внимание на появившуюся версию PHP и дебагера, что свидетельствует о правильности установки.

Чтобы убедиться в том, что правильно отрабатывает подключенный интерпретатор PHP, создадим в PhpStorm новый проект, добавим к нему файл index.php и запишем в этот файл, например, функцию var_dump([ 1, 2, 3 ]) с переданным в неё массивом.
Нажав правой кнопкой мыши на этом файле, выберем Open in Browser -> Default.
На странице мы видим характерный вывод var_dump(), который генерируется с помощью Xdebug. И, если посмотреть на заголовки ответа через консоль разработчика, то мы увидим, что всё работает верно:
server:PhpStorm 2016.1 X-Powered-By:PHP/5.6.19

Начальная настройка Xdebug и установка его под линукс описана в статье Установка модуля Xdebug для PHP под Ubuntu Linux
Работа с отладчиком Xdebug в PhpStorm
Прежде чем приступит к отладке PHP-скриптов с помощью Xdebug произведем необходимую настройку в файле php.ini. В секции Dynamic Extensions после подключения расширения Xdebug добавим следующие настройки:
xdebug.remote_enable=1 xdebug.remote_port=9000 xdebug.profiler_enable=1 xdebug.profiler_output_dir="c:\php\tmp"
Теперь зайдем в PhpStorm и откроем настройки. Перейдем в Languages & Frameworks -> PHP -> Debug. В секции Xdebug убедимся, что установлены следующие настройки:
Debug port: 9000 Установлен флажок Can accept external connections

Чтобы проверить, что все действия были проведены верно, добавим в уже имеющийся в проекте файл index.php следующий код:
И поставим точку остановки на переменной $arr.
Теперь запустим отладку этого скрипта, нажав правую кнопку мыши и выбрав пункт Debug ‘index.php’. Если все было сделано правильно, то в PhpStorm появится вывод дебага, как показано на скриншоте.

В итоге, мы получили мощный и удобный инструмент для отладки PHP-скриптов с подключенным интерпретатором PHP, а также возможность запускать скрипты через встроенный в PhpStorm локальный web-сервер.
