MikeTheCoder
MikeTheCoder

Reputation: 963

Trying to create a new application in Yii: env: php: No such file or directory

I'm trying to create a new yii app from the terminal. My YiiRoot folder is in my htdoc folder. I'm first going into my webroot:

$ cd /Applications/MAMP/htdocs

I'm then going into yiic and trying to create a new application:

/Applications/MAMP/htdocs/YiiRoot/framework/yiic webapp demo

I'm then getting this message:

env: php: No such file or directory

I've also tried:

cd /Applications/MAMP/htdocs/YiiRoot/framework
yiic webapp /Applications/MAMP/htdocs
-bash: yiic: command not found

And:

cd /Applications/MAMP/htdocs/YiiRoot/framework 
./yiic webapp /Applications/MAMP/htdocs
 No such file or directory

And:

 cd /Applications/MAMP/htdocs/YiiRoot/framework 
 php yiic webapp /Applications/MAMP/htdocs
 -bash: php: command not found

And:

 cd /Applications/MAMP/htdocs/YiiRoot/framework 
 php yiic.php webapp /Applications/MAMP/htdocs
 -bash: php: command not found

I'm completely out of ideas. Any advice please?

Upvotes: 2

Views: 8080

Answers (3)

MikeTheCoder
MikeTheCoder

Reputation: 963

As it turns out, my particular problem was that php was somehow erased of my system. When I typed find /usr -name php into the terminal there was no indication that the /bin/php file existed. So I asked another question on stackoverflow in an attempt to trouble shoot my php command line problem. So the answer to this question is actually the answer to that question which can be found HERE.

Upvotes: 3

Alfredo Castaneda Garcia
Alfredo Castaneda Garcia

Reputation: 1659

This is pretty common. You need to edit the file Yiic.bat, which is in the folder yii/framwork. There you'll find the line

PHP_COMMAND

Its predifine value usually is just "php.exe". Change that value to the actual address of your php.exe file. Assuming you have a MAMP installation, you could find the php.exe file in the mamp/php/ folder, so the value to PHP_COMMAND would be:

root:/address_to_mamp/mamp/php/php.exe

Upvotes: 1

dInGd0nG
dInGd0nG

Reputation: 4114

You have to install the php-cli package for your disro.

Upvotes: 2

Related Questions