Assuming that you have already install the wampserver on your windows.
- extract zip framework file from http://www.yiiframework.com/download to c:\wamp\www folder
- rename yii-1.1.13.... folder to yii (so the path should be c:\wamp\www\yii and the framework itself will be into c:\wamp\www\yii\framework)
- on c:\wamp\www creates a file with the extension 'bat' (for example myrun.bat), then open it with an editor (I suggest you notepad++) and put this code
set PATH=%PATH%;C:\wamp\bin\php\php5.4.3
cmd
note the C:\wamp\bin\php\php5.4.3 is the php folder path on my system, so you have to check which is yours
save the changes of the file myrun.bat
run the myrun.bat like as an executable file. A console command line will be appeared.
ensure that the current path is c:\wamp\www and then type
php yii/framework/yiic.php webapp myfirstsite
That's it! a folder named myfirstsite has been generated and now you can see the site on your browser typing localhost/myfirstsite or 127.0.0.1/myfirstsite (ensure that the wampserver is running!)
Awesome solution
I have tried your given guide line and it just took 5-10 minutes to do everything.That is awesome tutorial.
Thanks for sharing it. :)
RE: Awesome solution
Thanks a lot codesutra!
I will thing a solution to reduce this time to 2-3 minutes!
Stay tuned :)
improvements
Hi there.
Thanks for the wiki, first of all.
I like the approach, but I think that this way there is not so much time improvement. For instance, you could set tha PATH in the system once and for all in the windows system, and I don't think that the execution of the command 'cmd' takes more than a few seconds (windows key + 'cmd' + enter key).
Besides that, I'd like to have the framework out of the www directory.
I'll take some time to find another way with your approach ;)
Bye
RE:improvements
Hi my friend
Personally I prefer to have a file with me rather than configure windows settings
I use often differents PC's on my work, at my home, or laptop, friends, my students etc.
Especially is tedious task when I have to face different verions of windows (XP, Seven etc). By settings the path by bat files and run through this the command line, I think it will works forever on windows!
Also in the framework in one level up, you could use that
In any way thank you for your comment! :)
little bat script to create a new app
I just wrote down a little bat script for windows which, once set up for the first time with an editor, allows you to input the name of the app and then calls the yiic to create the yii app.
The first two lines are commented because I entered those configurations in my system. If you haven't, just uncomment and set with your paths.
I tested it on win7 and it works. I think I'll improve to handle also different version of the framework, so any suggestion is well accepted.
:)
https://gist.github.com/masiorama/6063334
HOWTO: copy the code, paste in a file with extension .bat, and double click.
RE: little bat script to create a new app
Thanks pal!
I thought similar thing.
You could improve your bat file, for example:
if YII_COM detected automatically by recursive loop until find the yii.xx.x../ and confirms that contains framework/yiic.* file then your code will be works in any case of yii version framework :)
RE: little bat script to create a new app
I understand, something like glob the yii_com directory and let the user choose the yii version by selection in the shell. I'll try that improvement asap.
Hi :)
RE: little bat script to create a new app
I just updated it, with a minimal menu implementation, which read the yii-directories and let you decide which version select for the creation of the app.
So far there are no check on errors, inputs and it is pretty ugly code, but it works.
RE:RE: little bat script to create a new app
@SomethingWicked, you have very good background on batch console script
bravo! I use it! :)
RE:RE: little bat script to create a new app
It is actually my first batch script, I googled and used this useful list of commands (http://ss64.com/nt/) to find out what I needed.
Thanks for the appreciation :)
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.