17

I am trying working with symfony since past couple of months. Last night I did an auto remove to purge not needed repositories. After that I have not been able to create a new symfony project using the symfony command. When I run Symfony new SecurityDemo 2.8.1 in the terminal, I get the error

Symfony: command not found

I tried installing the Symfony Installer again as directed in the documentation http://symfony.com/doc/current/setup.html. I went to my root directory and followed the installation procedure as shown in the screenshot enter image description here

Still I get the same error.

All help is appreciated.

EDIT:

I am working with LAMP and am using PHP 5.6.

When I try to update the symfony Installer using symfony self-update I get the output

// Symfony Installer is already updated to the latest version (1.5.8).

12 Answers 12

25

Add the following line to your shell configuration file:

export PATH="$HOME/.symfony/bin:$PATH"

3
  • 3
    The shell configuration files are '~/.bashrc' and '~/.profile' in the home directory Commented Jun 17, 2021 at 13:09
  • 1
    To edit ~./bashrc in Linux, you can use sudo gedit ~/.bashrc Commented Sep 27, 2021 at 2:36
  • 2
    Don't forget to re 'source' your terminal session after adding to PATH or restart terminal window. source ~/.bashrc Commented Oct 3, 2022 at 11:52
16

For me the fix was to reinstall symfony:

curl -sS https://get.symfony.com/cli/installer | bash

see here https://symfony.com/download

as far as I experienced, it does not tamper with the environment.

1
  • This worked perfectly for me. Thank you.
    – Niklas
    Commented Aug 13 at 13:06
3

If you're sure you installed the symfony command properly you have to call it with lowercase s and not Symfony.

The correct command is:

$ symfony new SecurityDemo 2.8.1

http://symfony.com/doc/current/setup.html#basing-your-project-on-a-specific-symfony-version

1

Try call Symfony it in lowercase as example:

>symfony new SecurityDemo 2.8.1

Hope this help

1

I had the same problem. The right command would be:

php symfony new SecurityDemo 2.8.1

Not sure why it would not work without the word php even though the documentation does not prescribe it.

0
1
cd your-project/
composer require symfony/web-server-bundle --dev
php bin/console server:start

Working beautifully for me on Fedora 33 Workstation

base: https://symfony.com/doc/4.0/setup/built_in_web_server.html

1

When you run curl -sS https://get.symfony.com/cli/installer | bash to install Symfony CLI Installer. After installation run either of the next commands:

Use it as a local file:
  /root/.symfony5/bin/symfony

Or add the following line to your shell configuration file:
  export PATH="$HOME/.symfony5/bin:$PATH"

Or install it globally on your system:
  mv /root/.symfony5/bin/symfony /usr/local/bin/symfony

Then start a new shell and run 'symfony'

1

After Symfony CLI is installed successfully, you run the command below

sudo mv /home/{username}/.symfony5/bin/symfony /usr/local/bin/symfony

to install it globally on your system

Replace {username} with your actual username.

0

Turns out that I cannot use capital 'S' in symfony. using symfony new project_name did the trick.

0

The Right Command is

symfony new SecurityDemo 2.8.1
0

If you can’t use the Symfony installer for any reason, you can create Symfony applications with Composer, the dependency manager used by modern PHP applications.

composer create-project symfony/framework-standard-edition SecurityDemo "2.8.1"

make sure you've already install composer.

-1

try this

composer require symfony/flex
composer install
1
  • 3
    You don't need to install after require. Commented Jul 20, 2021 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.