'Can't create a new Symfony project
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?
Solution 1:[1]
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
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Preciel |
Solution 2 | yavuz16dev |