Setting up a basic Yii application - php

Im new to Yii frame work and im on their website and im trying to get my first application working.
from this link http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app they are asking me to type % YiiRoot/framework/yiic webapp WebRoot/testdrive into the command prompt
Yii root is at this directory: E:\Documents\Webdesign\htdocs\yii\
when i type this
% E:\Documents\Webdesign\htdocs\yii\framework/yiic webapp
E:\Documents\Webdesign\htdocs/testdrive
into the cmd i get
'%' is not recognised as a internal or external command, operable program or batch file.
What could be the problem?
can any body help me to get this working?

Go to this folder using cd E:\Documents\Webdesign\htdocs\yii\framework command
After this type yiic webapp testdrive command

In this context here is the meaning of this statement:
% YiiRoot/framework/yiic webapp WebRoot/testdrive
% YiiRoot/framework/yiic - Change into the directory where you keep the yii library. In this case, you would open your terminal and type: cd E:\Documents\Webdesign\htdocs\yii\. Leave out the % sign.
webapp - Is the actual command that yiic recognises. It is the one that allows you to generate an application. That means after changing the directory, you would them type webapp. Don't press enter until you have typed in the path. So in the end, this part of your command will look like this: webapp /path/to/where/you/want/to/create/the/application
WebRoot/testdrive - Lastly, this refer to the directory where you would like your application to be created.
I hope this helps :-)

Related

Laragon - How do I serve a website on startup?

Right now I have to open laragon start all > go into commands > and write php artisan serve, only then can I access the local website.
My question is how can I start all and serve the website on start of the program.
Thank you in advance!
you have to put your project folder into C:\laragon\www\
when start the laragon service it's gonna search in that folder and use the name of the folder project to create a custom url, for example
if you put your project folder named newproject into the C:\laragon\www folder, when you start the service, laragon it's gonna make an url with the name of that folder newproject.test
C:\laragon\www\newproject-> newproject.test
C:\laragon\www\blog-> blog.test

Yii framework installation

I am new with yii framework. I have downloaded yii-1.1.14.f0fee9.zip file, I extracted and renamed it as yii and placed to my wamp root directory. For creating sample skeleton application, first I created test_project folder in wamp root and then run folling lines to cmd prompt.
cd c:\wamp\www\yii\framework
yiic webapp ..\test_project
these lines executed in cmd prompt without error. But, could it see create any sample or skeleton files under test_project folder. I have also tried to run it with browser. It showing blank. Anybody can please help me to start a skeleton project in yii ? Iam really interesting to develop projects in yii. please help me guys.
Follow the steps
cd c:\wamp\bin\php\phpx.x.xx
c:\wamp\www\yii\framework\yiic webapp c:\wamp\www\test_project
Note that in step 1. is your php directory that has php.exe file
Update:
For detail you can have a look at this link http://www.larryullman.com/series/learning-the-yii-framework/
This is a very good tutorial for Yii application initiation.
hope this will help
I've never used wamp but as I see it has a WWW directory. You should place your projects in this directory, otherwise it won't be available for browsers. (Never take the framework files here, just leave there than you placed before)
Using yiic. It is a command line tools (doesn't work from browser) for making skeleton app, migrations etc.
try:
cd (c:....... framework) [enter]
yiic webapp c:\......\www\test_project [enter]
The main are points the WWW and the separated command
I guess it will work.
Greg

How to execute codeigniter controller from batch file

i want to schedule a task to run at certain time in php and i am using codeigniter framework .
so want to write a batch file to execute the given function in a given controller. Ihave written a batch file for simple php file its working correctly but giving an error while writing for the codeigniter.
below is my batch file for codeigniter
C:\xampp\php\php.exe -f C:\xampp\htdocs\DatabaseServices\index.php\controller_name\FUNCTION_NAME
it is giving an error 'unable to load the file'
See the Codeigniter Documentation on the CLI interface.
Now normally you would visit the your site using a URL similar to this: example.com/index.php/tools/message
Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project:
$ cd /path/to/project;
$ php index.php tools message
Make sure you are sending the right arguments for your controllers.
In your case:
cd C:\xampp\htdocs\DatabaseServices
C:\xampp\php\php.exe index.php controller_name FUNCTION_NAME

bash command not found, or other workaround?

I'm working with the book Agile Web Development with Yii. In Chapter 8, it creates a php script to set up a RBAC (role based access control) so that when we access the shell at
/framework/yiic shell
it should allow us to enter a command
rbac
Pursuant to the PHP script that we created, the command creates three roles, Owner, Member and Reader with various permissions.
My problem is that, working with MAMP, when I do the command
yiic shell
it says
-bash: yiic: command not found
Therefore, I can't create these roles, and then I can't continue along with the book, because I don't know any work around
Can anyone help?
UPDATE
pursuant to one of the answers below, I did chmod +x yiic
Now when I run /framework/yiic shell it seems to enter the shell but not the same one described by my book
The book tells me I should get this
% YiiRoot/framework/yiic shell Yii Interactive Tool v1.1 (based on Yii v1.1.2) Please type 'help' for help. Type 'exit' to quit. >>
Now type help to see a list of available commands:
>> help
At the prompt, you may enter a PHP statement or one of the following commands:
- controller
- crud
- form
- help
- model
- module
- rbac
Type 'help <command-name>' for details about a command.
However, I'm getting
USAGE
yiic shell [entry-script | config-file]
DESCRIPTION
This command allows you to interact with a Web application
on the command line. It also provides tools to automatically
generate new controllers, views and data models.
It is recommended that you execute this command under
the directory that contains the entry script file of
the Web application.
PARAMETERS
* entry-script | config-file: optional, the path to
the entry script file or the configuration file for
the Web application. If not given, it is assumed to be
the 'index.php' file under the current directory.
Try the full path:
/framework/yiic shell
You have to add /framework/ to your $PATH-environment variable if you want to use yiic without giving the full path.
You might need to specify the path:
/framework/yiic
or include the directory in your PATH
PATH="$PATH:/framework"
export PATH

Symfony database setup: command "symfony" in ms-dos doesn't work

I am trying to do this:
c:\> php symfony configure:database "mysql:host=localhost;dbname=jobeet" root mYsEcret
This doesnt work for me because it says
Could not open input file
I thought I needed to add symfony-file located in C:\dev\sfprojects\jobeet\lib\vendor\symfony\data\bin\ to PATH, but this didn't do the trick. I tried to enter the whole path to the symfony-file like so:
c:\> php C:\dev\sfprojects\jobeet\lib\vendor\symfony\data\bin\symfony\ configure:database "mysql:host=localhost;dbname=jobeet" root mYsEcret
I get error Task configure:database not defined
What should I do in order to:
Be able to use the symfony keyword
rather than the whole path of the
file
Be able to run configure:database?
Thank you for your time.
Kind regards,
Marius
You need to be in the directory of your symfony project, in this case C:\dev\sfprojects\jobeet\.
"Because the symfony shortcut file is executable, Unix users can replace all occurrences of 'php symfony' by './symfony' from now on.
On Windows you can copy the 'symfony.bat' file to your project and use 'symfony' instead of 'php symfony":
http://www.symfony-project.org/jobeet/1_4/Doctrine/en/01#chapter_01_sub_application_creation

Categories