-->

Symfony CreateProccess Error

2019-09-06 08:23发布

问题:

I started using Symfony today and I wanted to use the CLI. So I have installed PHPstorm. Followed all instructions. Added an up to date php 5.4

Now when I try to run:

> $ php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml 

Cannot run program "$" (in directory "E:\wamp\www\Symfony"): CreateProcess error=2, The system cannot find the specified map

Any ideas on how to fix this?

Edit

> php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml
Cannot run program "php" (in directory "E:\wamp\www\Symfony"): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden

> php.exe app/console generate:bundle --namespace=Acme/HelloBundle --format=yml
Cannot run program "php.exe" (in directory "E:\wamp\www\Symfony"): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden

I tried the answers, but it doesn't seem to change anything! Is this a bigger thing?

EDIT 2 SOLVED SO FAR

> c:\full\path\to\your\php.exe app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

That piece saved my life, thanks!

回答1:

> php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

As there $ normally means your terminal invitation. And you try to run command '$' with the rest of string being parameters.

> c:\full\path\to\your\php.exe app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

OR add path to php to %PATH%



回答2:

$ is just a markup showing that this is run in console. If you are running this on Windows, you should do it like this:

php.exe app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

To make php work in CLI, you need to add the path to it's binary (where php.exe resides) to PATH.