Can't create a new Symfony project
Asked Answered
C

5

7

I can't create a new Symfony project as described in the Symfony Documentation: https://symfony.com/doc/4.3/setup.html

This is the command I use: symfony new --full my_project

Output:

$  symfony new --full my_project
WARNING The current directory seems configured for as a SymfonyCloud project, but it is not linked yet.
        You can link this directory to an existing project: symfony link [project-id] (get project IDs via symfony projects)

* Creating a new Symfony project with Composer

  unable to find composer, get it at https://getcomposer.org/download/: exec: "composer": executable file not found in  
  $PATH

I don't understand why the command can't find the composer executable.

When I just enter $ composer in my terminal, composer is executed.

This is my Symfony CLI version: Symfony CLI version v4.6.1

In my .bash_profile file, I have an alias for composer:

alias composer="php /usr/local/bin/composer.phar"

My /etc/paths:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

What is wrong in my config?

Circinus answered 17/7, 2019 at 15:45 Comment(0)
R
5

Most likely, it's because you didn't rename composer.phar.

First, do this:

mv /usr/local/bin/composer.phar /usr/local/bin/composer

It will rename composer.phar to composer.

Then you can also delete your alias. Alias are for connected users. Executable and installer don't read your aliases, which is why symfony installer isn't finding composer.

If it doesn't solve your problem, you can try to install your Symfony project with composer directly:

composer create-project symfony/website-skeleton my_project
Rite answered 17/7, 2019 at 15:58 Comment(0)
H
1

You can also check what php version is that your symfony is using In my case it was linked to php 5 and by changing to php 7 problem has been resolved

To check php version linked use :

symfony local:php:list

And then to edit your php version create a .php-version file then write the version that you want to use

Handedness answered 8/5, 2022 at 20:20 Comment(0)
F
0

This is not quite the same, but i couldnt get working command:

symfony new my_project_directory --version="6.3.*" --webapp

it was ending with error:

unable to run C:\ProgramData\ComposerSetup\bin\composer.phar

Problem was with the drive. When I started project on C: it worked like a charm .

Forsake answered 20/7, 2023 at 16:48 Comment(0)
H
0

Please follow these steps:

  • Open XAMPP Control Panel

  • Goto config button on Apache and open php.ini file

  • Search for zip, you will get following:

    ;extension=zip

  • Remove semi-colon (;) and save:

    extension=zip

  • Now try to create project with composer, issue will be solved.

    composer create-project symfony/website-skeleton project_name

  • Done

NOTE: This process will work for every php framework that you are using and creating project with composer.

Hermon answered 2/2 at 7:52 Comment(0)
D
0

For those who have read all advice here and nothing worked, make sure you are creating a project in a directory that is not "read-only".

Depict answered 12/8 at 7:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.