Monday 9 December 2013

Creating Skeleton App for Yii in Ubuntu

To install Yii, you need to get the latest version and extract it somewhere in your  server’s web root,

 probably here i extract it in  /opt/lampp/htdocs/

here i renamed the extract folder name as yii-1.1.14, after that you have to change the permission of the folder as 0755 to execute yiic file, so that it is executable.


root@mindzls002-desktop:/home/mindzls002# sudo chmod -R 0755 /opt/lampp/htdocs/yii-1.1.14/

Before creating your skeleton app , we want to verify that your server satisfies Yii's requirements.
Yii requires PHP 5.1, so the server must have PHP 5.1 or above installed and available to the web server.

 To check that your server meets the requirements, simply run the below url in your web browser,

      http://localhost/yii-1.1.14/requirements/
 If your server the passes the requirements, then the run the below command in your terminal,

root@mindzls002-desktop:/home/mindzls002#  /opt/lampp/bin/php  /opt/lampp/htdocs/yii-1.1.14/framework/yiic.php  webapp  /opt/lampp/htdocs/cabel

In the above code,

i) first path refers to location of php,
ii)  second path refers to the location of yiic.php (i.e. the file located in the folder         that we extract in your web root initially)
iii) third path refers to where we want to create a skeleton app. Here i created a skeleton app named cabel.

After you run the above code in terminal , a message is prompted in terminal for verification as

  Create a Web application under '/opt/lampp/htdocs/cabel'? (yes|no) [no]:

  type yes and hit enter. The terminal runs the following codes,

mkdir /opt/lampp/htdocs/cabel
   generate index.php
      mkdir /opt/lampp/htdocs/cabel/css
   generate css/main.css
   generate css/form.css
   generate css/screen.css
   generate css/ie.css
   generate css/bg.gif
   generate css/print.css
      mkdir /opt/lampp/htdocs/cabel/images
      mkdir /opt/lampp/htdocs/cabel/protected
   generate protected/yiic
      mkdir /opt/lampp/htdocs/cabel/protected/tests
      mkdir /opt/lampp/htdocs/cabel/protected/tests/unit
      mkdir /opt/lampp/htdocs/cabel/protected/tests/report
   generate protected/tests/phpunit.xml
      mkdir /opt/lampp/htdocs/cabel/protected/tests/functional
   generate protected/tests/functional/SiteTest.php
   generate protected/tests/WebTestCase.php
      mkdir /opt/lampp/htdocs/cabel/protected/tests/fixtures
   generate protected/tests/bootstrap.php
      mkdir /opt/lampp/htdocs/cabel/protected/runtime
   generate protected/yiic.php
      mkdir /opt/lampp/htdocs/cabel/protected/data
   generate protected/data/schema.sqlite.sql
   generate protected/data/testdrive.db
   generate protected/data/schema.mysql.sql
      mkdir /opt/lampp/htdocs/cabel/protected/vendor
      mkdir /opt/lampp/htdocs/cabel/protected/components
   generate protected/components/Controller.php
   generate protected/components/UserIdentity.php
   generate protected/.htaccess
      mkdir /opt/lampp/htdocs/cabel/protected/views
      mkdir /opt/lampp/htdocs/cabel/protected/views/layouts
   generate protected/views/layouts/main.php
   generate protected/views/layouts/column1.php
   generate protected/views/layouts/column2.php
      mkdir /opt/lampp/htdocs/cabel/protected/views/site
   generate protected/views/site/index.php
      mkdir /opt/lampp/htdocs/cabel/protected/views/site/pages
   generate protected/views/site/pages/about.php
   generate protected/views/site/contact.php
   generate protected/views/site/error.php
   generate protected/views/site/login.php
      mkdir /opt/lampp/htdocs/cabel/protected/commands
      mkdir /opt/lampp/htdocs/cabel/protected/commands/shell
      mkdir /opt/lampp/htdocs/cabel/protected/migrations
      mkdir /opt/lampp/htdocs/cabel/protected/config
   generate protected/config/console.php
   generate protected/config/main.php
   generate protected/config/test.php
      mkdir /opt/lampp/htdocs/cabel/protected/extensions
      mkdir /opt/lampp/htdocs/cabel/protected/controllers
   generate protected/controllers/SiteController.php
   generate protected/yiic.bat
      mkdir /opt/lampp/htdocs/cabel/protected/messages
      mkdir /opt/lampp/htdocs/cabel/protected/models
   generate protected/models/LoginForm.php
   generate protected/models/ContactForm.php
      mkdir /opt/lampp/htdocs/cabel/themes
      mkdir /opt/lampp/htdocs/cabel/themes/classic
      mkdir /opt/lampp/htdocs/cabel/themes/classic/views
   generate themes/classic/views/.htaccess
      mkdir /opt/lampp/htdocs/cabel/themes/classic/views/system
      mkdir /opt/lampp/htdocs/cabel/themes/classic/views/layouts
      mkdir /opt/lampp/htdocs/cabel/themes/classic/views/site
      mkdir /opt/lampp/htdocs/cabel/assets
   generate index-test.php

Your application has been created successfully under /opt/lampp/htdocs/cabel.

 Then Bingo, yii has successfully created the skeleton app for your project.
 Now you have to change the folder permission of the created skeleton app folder(cabel) to run it on browser.

run the below code in terminal,
root@mindzls002-desktop:/home/mindzls002# chmod -R 0555 /opt/lampp/htdocs/cabel/
root@mindzls002-desktop:/home/mindzls002# chmod -R 0777 /opt/lampp/htdocs/cabel/protected/

Finally you have created the yii skeleton app, now run the below url in your web browser to view the welcome screen,

    http://localhost/cable/

 that's it, 




    

   
   














No comments:

Post a Comment