how to create webapp with yiic command using Yii Framework

耗尽温柔 提交于 2020-01-13 12:07:25

问题


I'm trying to build my first app in Yii, the guide on their website at the following address: http://www.yiiframework.com/doc/guide/1.1/he/quickstart.first-app # add-comment The problem is that any issue installing the application framework through the YIIC can not have that. I did the following: 1. I went through the CMD Library of the framework that is my WAMP server. 2. I wrote the following command: yiic.php webapp www/blog, I also tried the following command: yiic webapp www/blog.

As I understand their guide, should there be a directory called blog with a skeleton application. What actually happens is that windows opens me the window titled "Open With" asking me to choose which program I want to open the yiic.php to view the contents of the file.


回答1:


On windows you just go to your framework folder and type:

yiic webapp pathToYourNewProject

yiic will default to yiic.bat so you don't need to specify any php.exe (I'm not saying that it wouldn't work like that). and path to your new project can be relative or absolute, here are some examples:

-- C:
   |
   -- sandbox/
     |
     --yii/
     | |
     | --framework/
     |   |
     |   --yiic.bat (for Window)
     |   --yiic.php (for Linux)
     --newWebApp/

To create on Windows i use:

cd c:\sandbox\yii\framework
yiic webapp ../../newWebApp
type yes when prompted and you're done

or

cd c:\sandbox\yii\framework
yiic webapp c:\sandbox\newWebApp
type yes when prompted and you're done

To create on Linux:

cd /media/sf_sandbox/yii/framework/
./yiic webapp ../../newWebApp



回答2:


It's always better to follow yii official documentation. You can find Installing Yii process step by step here

documentation> tutorial > The Yii Blog Tutorial > Testdriving with Yii # Installing Yii

here is the link http://www.yiiframework.com/doc/blog/1.1/en/start.testdrive#installing-yii


If you getting this kind of error when you try to use yiic webapp ..\app-name

'"php.exe"' is not recognized as an internal or external command, operable program or batch file.

Open the yiic.bat file under yii framework folder ( C:\wamp\www\framework ) and change the bellow line

if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe

to

if "%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.4.16\php.exe

php5.4.16 this might be change accroding to you php version, please check in C:\wamp\bin\php folder before change

or else you can set this path variable as Environment Variable ( Control Panel\All Control Panel Items\System > advance system settings > Environment Variable ) what you have to do is add this C:\wamp\bin\php\php5.4.16\php.exe with ; after path value like bellow image




回答3:


I think you're on Windows? It needs to know that php files should be opened with php.exe, so you'll need to call php.exe yiic.php webapp www/blog.

To provide this, they also added yiic.bat, so you can just call yiic webapp www/blog, provided that php.exe is in your environment path. If not, it may be just as well to add it (Computer, properties, advanced settings, environment variables), so you can execute php scripts more easily in the future.




回答4:


The command for creating project is

yiic webapp test

in wich test is the project name.

For more details check this link

http://dcageek.blogspot.com/2013/06/how-to-install-yii-framework-on-windows.html




回答5:


Also if you face the problem after adding the php engine path in environment variable by computer properties .directly you can add the yii.bat location by "C:\wamp\www\Yii\framework" The location I given as a example means my yii framework bat file located at C:\wamp\www\Yii\framework

Above can be done through by going to : Start -> My Computer (right click!) -> Advanced Tab -> Environment Variables -> Click Path in System variables -> Edit.

for more details How to Install Yii Application




回答6:


1-Used command prompt/DOS and go to the cd c:\wamp\www\yii\framework. Here "yii" folder has the yii files.

2-Then type yiic webapp ../../yiimyapp. Here yiimyapp is my new folder in the www folder of wamp.

3-After that it will ask to confirm to create the app in the www folder. Type yes and enter.

4-App will be created. Go to the www folder and you can see newly created "yiimyapp" folder with files.

If you need to create the app inside the yii/demos folder just type yiic webapp ../demos/yiimyapp in the above step 2. Then app folder will create inside the yii demos folder. not as separate folder in the www root.

That's only.




回答7:


This manual for installing yii 2.0from this link.



来源:https://stackoverflow.com/questions/12767326/how-to-create-webapp-with-yiic-command-using-yii-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!