简体   繁体   English

由于无法识别php,yiic.bat文件未运行

[英]yiic.bat file not running due to php not recognized

I am trying to set up yii for the first time and use yiic.bat. 我正在尝试首次设置yii并使用yiic.bat。 I have been reading the post with the same issues and they all say add the directory to the windows path. 我一直在阅读具有相同问题的文章,他们都说将目录添加到Windows路径。 However something isn't working out. 但是,有些事情没有解决。 Here is what I did: 这是我所做的:

My computer: Windows 7 Wamp php directory : C:\\wamp\\bin\\php\\ yii-1.1.14.f0fee9.tar.gz 我的电脑:Windows 7 Wamp php目录:C:\\ wamp \\ bin \\ php \\ yii-1.1.14.f0fee9.tar.gz

1: I downloaded, unzipped and put it in my C:\\wamp\\www directory 1:我下载并解压缩后放在C:\\ wamp \\ www目录中
2: I renamed the folder as yii 3: I added ;C:\\wamp\\bin\\php\\ to the path for windows 4: I restarted my computer to make sure the path took affect 5: I created a file called myrun.bat in C:\\wamp\\www directory the content of the file: set PATH=%PATH%;C:\\wamp\\bin\\php\\php5.4.3 cmd 6: When i try to run the cmd pops up 7: I type php yii/framework/yiic.php webapp myfirstsite 2:我将文件夹重命名为yii 3:在Windows路径中添加; C:\\ wamp \\ bin \\ php \\ 4:重新启动计算机以确保路径生效5:创建了名为myrun.bat的文件在C:\\ wamp \\ www目录中文件内容:set PATH =%PATH%; C:\\ wamp \\ bin \\ php \\ php5.4.3 cmd 6:当我尝试运行cmd时弹出7:我键入php yii / framework / yiic.php webapp myfirstsite

The cmd results are: 'php' is not recognized as an internal or external command, operable program or batch file. cmd结果为:'php'不被识别为内部或外部命令,可操作程序或批处理文件。

Any type of advice would help. 任何类型的建议都会有所帮助。 Thank you. 谢谢。

我不确定php.exe在哪里,您应该找到php.exe的目录,也许是C:\\ wamp \\ bin \\ php \\ php5.4.3 \\ bin,然后将此路径添加到%PATH%

No need for any %PATH% variable, just fallow these steps: 无需任何%PATH%变量,只需执行以下步骤:

  1. When you download the Yii from the website, there is a folder called framework inside the rar file you downloaded. 当您从网站下载Yii时,您下载的rar文件中有一个名为framework的文件夹。 Copy that folder to your webserver root directory, which is in my case C:\\wamp\\www . 将该文件夹复制到您的Web服务器根目录,在我的情况下为C:\\wamp\\www

  2. In the www folder also create a new folder called NewYiiApp . www文件夹中,还创建一个名为NewYiiApp的新文件夹。 Inside this folder your new Yii application will be created and here you will write your controllers, models and classes. 在此文件夹中,将创建新的Yii应用程序,并在此处编写控制器,模型和类。

  3. After that open your cmd using Start->Run->cmd. 之后,使用Start-> Run-> cmd打开cmd。

  4. Using CMD navigate to the framework folder using cd C:/wamp/www/framework . 使用CMD使用cd C:/wamp/www/framework导航到framework文件夹。

  5. Open Windows Explorer and naigate to the PHP directory. 打开Windows资源管理器,然后导航到PHP目录。 In my case it is located in C:\\wamp\\bin\\php\\php5.3.13 就我而言,它位于C:\\wamp\\bin\\php\\php5.3.13

  6. Ensure that this folder contains php.exe file 确保此文件夹包含php.exe文件

  7. Paste the following line in the already opened CMD 将以下行粘贴到已打开的CMD中

  8. C:\\wamp\\bin\\php\\php5.3.13\\php.exe yiic webapp C:/wamp/www/NewYiiApp , but change my PHP folder path with yours C:\\wamp\\bin\\php\\php5.3.13\\php.exe yiic webapp C:/wamp/www/NewYiiApp ,但用您的更改我的PHP文件夹路径

  9. It will ask you: Create a web application under C:/wamp/www/NewYiiApp ? 它将询问您:在C:/wamp/www/NewYiiApp下创建Web应用程序? Type Yes and hit ENTER. 键入是,然后按Enter。

Hope I helped! 希望我能帮上忙!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM