Reputation: 4333
I'm trying to import a database structure to mapping with Symfony/Doctrine.
I followed the tutorial here and it gives the command to create mapping files from existing databases:
php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
But the PHP interpreter exits instantly:
PHP Fatal error: Option inconnue --from-database in Unknown on line 0
Could not startup.
(Option inconnue
means unknown option in french)
I can understand that PHP do not pass the arguments to app/console script.
If I try with HHVM, the arguments are sent to the PHP script (so, it runs fine).
PHP version: PHP 5.5.12-2ubuntu4.1
EDIT: Problem solved, see my answer below. I will accept it tomorrow (StackOverflow limitation).
Upvotes: 3
Views: 522
Reputation: 4333
Problem solved.
sudo apt-get purge php5-cli
sudo apt-get install php5-cli
It seems that a person had the same problem, and some people suggested that php.ini was missing.
So I reinstalled PHP and now it works perfectly.
If anyone have an explanation for this behaviour, it would be great!
EDIT: Hum, nope, there's a problem. It worked perfectly until I re-added my extensions in php.ini. I just added two lines:
extension=cairo.so
extension=php_gtk2.so
And now it's broken again... :/
Upvotes: 0
Reputation: 311
Because of the shebang in the console script, you can omit the php interpreter call in the command line by doing:
chmod +x app/console
./app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
or, alternatively, you can do:
php app/console -- doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
Please note the separating additional --
after the script input filename, that tell the php interpreter that each successive argument should be led to the script.
Upvotes: 1