Search code examples
phplaravelcomposer-phpphpstorm

I got this error 'Failed to create Composer project:' in my first Laravel project


I create my first Laravel project via PhpStorm but when I write this command in PhpStorm's terminal php artian serve I got this error:

'php' is not recognized as an internal or external command, operable program or batch file.

I have one more problem too:

Failed to create Composer project: Failed to run 'create-project' command

enter image description here


Solution

  • It seems that you system in not recognizing php and git, either they are not installed on your system of they are missed from the environment variable path for the system to recognize where they live.

    In the seconds case do this to add path to your PATH variable:

    Right click My Computer, go to advanced settings, click Environment Variables then edit the PATH system variable.

    Add a semi-colon and then the path to your PHP binary, i.e. ";C:\wamp\bin\php\php5.6" and do the same for git.