Blog de programación, errores, soluciones

Chose Language:
Author: Admin/Publisher |finished | checked

Laravel error “php: does not exist and could not be created”

In this section we will see how to solve “php: does not exist and could not be created” error, this error happens on Laravel, but probably happens in other apps that use composer too.

This error appears when we run for example “laravel new example1” on console. In my case I’m using Windows and XAMPP hence I put my Laravel projects on C:\xampp\htdocs , this is to have all my project together.

C:\xampp\htdocs
laravel new example
 _                               _
| |                             | |
| |     __ _ _ __ __ ___   _____| |
| |    / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V /  __/ |
|______\__,_|_|  \__,_| \_/ \___|_|

    Creating a "laravel/laravel" project at "./example1"
    Installing laravel/laravel (v8.6.2)
      - Downloading laravel/laravel (v8.6.2)
      - Installing laravel/laravel (v8.6.2): Extracting archive


  [RuntimeException]
  php: does not exist and could not be created.


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [] [] []

In this case, see the error when the following message appears:

[RuntimeException]
php: does not exist and could not be created.

To solve this problem, you only have to update your Composer.

composer self-update
Upgrading to version 2.1.6 (stable channel).

Unable to write "C:\ProgramData\ComposerSetup\bin\composer.phar". Access is denied.
Complete this operation with Administrator privileges [Y,n]? y
Operation succeeded.
Use composer self-update --rollback to return to version 2.1.4

Remember that you run “laravel new” command before solving the problem, so you probably need to erase the project folder that is created with the command, In my case, I run Laravel new example1, so I need to delete example1 folder and re-run laravel new example1. Problem solved

Category: en-laravel
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category