How to use php console in symfony2

I found the console and ran it as follows:

root@valugi-laptop:/var/www/sandbox/hello# php console
Symfony version 2.0.0-DEV - hello

Usage:
  Symfony [options] command [arguments]

Options:
  --help      -h  Display this help message.
  --quiet     -q  Do not output any message.
  --verbose   -v  Increase verbosity of messages.
  --version   -V  Display this program version.
  --color     -c  Force ANSI color output.
  --no-interaction -n  Do not ask any interactive question.
  --shell     -s  Launch the shell.

Available commands:
  help               Displays help for a command (?)
  list               Lists commands
assets
  :install           
bundle
  :pharize           
container
  :graphviz          
doctrine
  :generate-proxies  
init
  :application       
  :bundle            
router
  :debug             Displays current routes for an application
  :dump-apache       

But I can not run any of these commands. I try like this:

php console symfony -h

But I get

[InvalidArgumentException]         
Command "Symfony" is not defined.  

Any suggestions?

+3
source share
6 answers

Find the answer.

root@valugi-laptop:/var/www/sandbox/hello# chmod 777 /var/www/sandbox/src/Bundle
root@valugi-laptop:/var/www/sandbox/hello# php console init:bundle "Bundle\\ValugiBundle"
+1
source

The console is used as follows: $ php app/console [command name]

+6
source

: ./app/console --shell

+2

symfony2 :

php app/console init:bundle Acme\\DemoBundle src

src :

src/Acme/DemoBundle/
                    AcmeDemoBundle.php
                    Controller/
                               DefaultController.php
                    Resources/
                              config/
                                     routing.yml
                              views/
                                    Default/
                                            index.html.twig

Acme\DemoBundle.

+1

a bash script, , CLI , , PATH (,/usr/local/bin/).

CLI. sf <command>. Symfony 1.3/1.4, Symfony2.

0

, !

-

, , - , .

"php console Symfony", .

. , , , :
~/web/sandbox.sf2

/var/www like:
sudo ln -s ~/web/sandbox.sf2/home/myusername/web/sandbox.sf2

, , , symfony2. ( , , , , bin script, / sf2 init: bundle sf list )

(http://google.com/search?q=linux+permissions, ).

Make sure that you as a user / group can edit your files and folders. The php app / console application starts as the user you used (in this case root). Also make sure the apache user / group can read your files.

-

And please do not use the root account for chmod 777 -R when something is not working. Test simple ownership permissions, their easy and necessary concept, if you publish a web server on the World Wide Web.

-1
source

Source: https://habr.com/ru/post/1747902/