php interpreter is not configured phpstorm

Php interpreter is not configured phpstorm

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured 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(). Вводить нужно весь скопированный текст со страницы.

Копируем полученную информацию, нажимаем кнопку Analyse my phpinfo() output и получаем инструкцию по установке Xdebug.

В зависимости от вашей версии PHP и пути установки инструкция может отличаться от моей:

Подключение интерпретатора PHP к PhpStorm

Теперь перейдем в PhpStorm и откроем настройки комбинацией клавиш Ctrl+Alt+S.

Далее, в секции Languages & Frameworks выберем пункт PHP. В этой секции необходимо назначить интерпретатор для IDE в пункте Interpreter нажав на кнопку

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

В открывшемся окне, в поле Name вводим любое имя для удобства дальнейшей идентификации, например: PHP 5.6.11.

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

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

Чтобы убедиться в том, что правильно отрабатывает подключенный интерпретатор PHP, создадим в PhpStorm новый проект, добавим к нему файл index.php и запишем в этот файл, например, функцию var_dump([ 1, 2, 3 ]) с переданным в неё массивом.

На странице мы видим характерный вывод var_dump(), который генерируется с помощью Xdebug. И, если посмотреть на заголовки ответа через консоль разработчика, то мы увидим, что всё работает верно:

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

Начальная настройка Xdebug и установка его под линукс описана в статье Установка модуля Xdebug для PHP под Ubuntu Linux

Работа с отладчиком Xdebug в PhpStorm

Прежде чем приступит к отладке PHP-скриптов с помощью Xdebug произведем необходимую настройку в файле php.ini. В секции Dynamic Extensions после подключения расширения Xdebug добавим следующие настройки:

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

Чтобы проверить, что все действия были проведены верно, добавим в уже имеющийся в проекте файл index.php следующий код:

И поставим точку остановки на переменной $arr.

Теперь запустим отладку этого скрипта, нажав правую кнопку мыши и выбрав пункт Debug ‘index.php’. Если все было сделано правильно, то в PhpStorm появится вывод дебага, как показано на скриншоте.

php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

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

Источник

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.

Use this dialog to configure access to PHP engines installed on remote hosts or in development environments set up in Vagrant or Docker instances.

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.

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.

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.

    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.

    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.

    Источник

    Built-in web server

    PhpStorm has a built-in web server that can be used to preview and debug your application. This server is always running and does not require any manual configuration. All the project files are served on the built-in server with the root URL http://localhost: /

    , with respect to the project structure.

    The built-in server can only serve static content like HTML, JavaScript and CSS. To use it with PHP files, you need a local PHP interpreter specified for your project. When the interpreter is configured, PhpStorm will automatically start the PHP Built-In Web Server and redirect all PHP requests to it as soon as you run your PHP application. To run your PHP application, either open a file in the browser or create a dedicated run/debug configuration and launch it.

    If a Deployment server is defined for this project and marked as default, the file will be served from this server instead. If necessary, you can still open the page via the PhpStorm built-in web server. To do this, open the desired browser and type the URL of the file with respect to the project structure, using http://localhost: /

    For more details on working with deployment servers, refer to the Deployment section.

    Open a file in a web browser

    To open a file that is intended to be rendered by a web browser (HTML, XML, JSP, and so on), do one of the following:

    Use the browser popup in the top right part of the editor window. Click the browser button to open the web server file URL, or Shift+Click it to open the local file URL.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    You can also preview HTML and PHP files via the built-in preview in the dedicated editor tab.

    PhpStorm built-in preview

    PhpStorm built-in preview makes your work faster as you no longer need to switch to the browser and refresh the pages. The preview is opened in a separate editor tab and reloaded automatically as you type or when you save the changes, depending on the reload behavior.

    Open the PhpStorm built-in preview

    Alternatively, hover your mouse pointer over the code to show the browser icons popup, and click php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm.

    Configure the built-in web server

    Use this spin box to specify the port on which the built-in web server runs. By default this port is set to 63342 through which PhpStorm accepts connections from services. You can set the port number to any other value starting with 1024 and higher.

    Can accept external connectionsIf this checkbox is selected, then the files on the built-in server running on the specified port are accessible from another computer.

    If this checkbox is cleared (by default), then the debugger listens only to local connections.

    For security reasons, any request to a page on the built-in server from outside PhpStorm is by default rejected and the authorization popup is displayed.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    To access the requested page, click Copy authorization URL to clipboard and paste the generated token in the address bar of the browser.

    However this behavior may be annoying, for example, it may block your debugging session if manual intervention is impossible. To suppress displaying the authorization popup, select the Allow unsigned requests checkbox.

    Use the PHP built-in web server on macOS

    On macOS, you may get the php-cgi not found error when trying to use the built-in server. This indicates that PhpStorm is configured to use the PHP interpreter bundled with macOS, which does not contain the php-cgi module.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    To be able to use the PHP built-in web server, do the following:

    Install an alternative PHP interpreter with the php-cgi module included. The most common options are as follows:

    Appoint the newly installed PHP interpreter for use in PhpStorm as described in Configure local PHP interpreters.

    Источник

    как настроить встроенный веб-сервер в PhpStorm

    Я работаю над Dreamweaver довольно долго, и недавно я бросил его из-за его ограниченных возможностей. Настройка локального env с помощью Dreamweaver довольно проста, и у меня не было проблем с этим. Поэтому я установил PhpStorm, думая, что будет довольно легко запустить мое веб-приложение PHP таким же образом, когда я использую DW, но когда я пытаюсь запустить свое веб-приложение в PhpStorm, используя его встроенный веб-сервер, я получаю 502 Bad Gateway ошибка, что я сделал, это просто импортировать папку (которая находится в каталоге www) в PhpStorm и попытаться запустить ее в браузере, но я не мог заставить ее работать локально. Я считаю, что мне нужно настроить интерпретатор в настройках, но как мне идти вперед и что я должен включить?

    когда я запускаю свой webapp с помощью WAMP URL-адрес выглядит как

    когда я запускаю его с помощью встроенного веб-сервера PhpStorm, URL выглядит как

    ошибка: 502 плохой шлюз.

    Теперь я совсем застрял.

    7 ответов

    во-первых (проверьте ваш переводчик)

    2-в настройках перейдите к PHP

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    второй (Добавить новый интерпретатор)

    2-напишите любое имя, на которое вы хотите ссылаться (по умолчанию PHP)

    3-перейдите к файлу каталога PHP из PHP home*

    надеюсь, это поможет вам

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    *Если вы используете wamp, вы найдете его в c:\wamp\bin\php (ваша версия php)

    Если вы используете xamp, вы найдете его C:\xampp\php

    может быть, поможет.

    после запуска PHP-сайта в браузере и получения 502 bad gateway ошибка, при переключении обратно на PHPStorm вы должны увидеть следующее сообщение:

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    на вашем компьютере должен быть установлен PHP. Для этого вы можете следить за установка PHP на Windows manual или если у вас есть шоколадный установлен, просто типа

    выберите configure PHP Interpreter ссылке или перейти к File / Settings / PHP и выберите установку PHP для текущего проекта. Вы также можете пойти в File / Default Settings / PHP и сделать то же самое, чтобы новый проект извлек выгоду из этих настроек.

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

    Если вы устанавливаете WAMP server или любой другой локальный сервер на вашем ПК. как я показал ниже фотографии, вы можете установить localhost по умолчанию на WAMP server

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    вы должны выбрать интерпретатор для вашего PHP storm для запуска встроенного веб-сервера.

    Если вы видите предупреждение «PHP interpreter is not configure» при запуске проектов в phpstrom, сделайте то, что Мина Фаузи объясняет выше. Но если вы хотите изменить номер порта, вы должны пойти в Файл > Настройки > сборка, выполнение и развертывание > отладчик

    Источник

    Configure remote PHP interpreters

    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:

    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 Installed tab of 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 Configure Remote PHP Interpreter dialog that opens, choose the SSH method.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    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.

    For remote hosts, PhpStorm by default suggests the /usr/bin/php location.

    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.

    By using the Docker configuration, you can access a PHP interpreter installed in a Docker container.

    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 Installed tab of 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 with PhpStorm in Docker.

    Configure a PHP interpreter in a Docker container

    In the Configure Remote PHP Interpreter dialog that opens, choose the Docker method.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    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.

    For Docker containers, PhpStorm by default suggests the php location.

    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.

    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.

    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 Installed tab of 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.

    Configure a PHP interpreter using Docker Compose

    In the Configure Remote PHP Interpreter dialog that opens, choose the Docker Compose method.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    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.

    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 Docker run configuration settings for details.

    For Docker containers, PhpStorm by default suggests the php location.

    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.

    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.

    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.

    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.

    Configure a PHP interpreter in a Vagrant instance

    In the Configure Remote PHP Interpreter dialog that opens, choose the Vagrant method.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    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.

    For Vagrant instances, PhpStorm by default suggests the /usr/bin/php location.

    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.

    Before you start, make sure the following prerequisites are met:

    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:

    Configure a PHP interpreter using WSL

    In the Configure Remote PHP Interpreter dialog that opens, choose the WSL method.

    php interpreter is not configured phpstorm. Смотреть фото php interpreter is not configured phpstorm. Смотреть картинку php interpreter is not configured phpstorm. Картинка про php interpreter is not configured phpstorm. Фото php interpreter is not configured phpstorm

    From the Linux distribution list, choose one of the installed Linux distributions to use.

    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.

    Provide additional configuration options

    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.

    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.

    Configure custom mappings

    Switch between configured PHP interpreters on the fly

    In the popup menu that opens, select one of the configured local or remote PHP interpreters.

    Источник

    Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *