Why does composer crash when restarting phpStorm (Windows)?

Question:

When restarting phpStorm and opening the project, composer stops working. Every time you have to reopen Tools / Composer / Init composer and specify the path to php.exe and composer.path . This problem is observed when opening only some projects. Tell me what could be the problem?

phpStorm 10.0.3

Answer:

In order for the settings of the composer to work, you need to fulfill the following 2 simple conditions.

  1. The PHP interpreter must be configured: Languages & Frameworks/PHP Interpreter (select the PHP executable php.exe) just above the PHP language level must correspond to the version of the selected interpreter.
  2. Actually, configure the composer itself. For this:
    • it must be available in the project: either installed globally, or the composer.phar file must be in the project folder. For global configuration, make sure the composer command in the console lists the commands.
    • specify the path to the used composer.phar file, either globally available or locally installed in the project.

Possible problems:

  1. The composer file is not available for your project. Make sure the composer command for global configuration or php composer.phar for local configuration is available in your project folder.
  2. The phpStorm settings do NOT specify the composer.phar file that is available in your project.
  3. PhpStorm stores local project settings in the .idea folder. Make sure you don't overwrite, delete or change this folder for your project on reboot. Also make sure that the path to the project is correct and has not been changed on reboot.

In the end, I would like to say that you are very limiting the answers to your question by initially narrowing them down to the part that has no longer brought you a positive result. You would be better off asking how to implement exactly what you need. For example, how do you install a new package into a project using the composer? Perhaps, and most likely, there are simpler solutions to your problem that you simply do not know about.

Scroll to Top