yii2 installation - migrate command not working - php

I am trying to install yii2 in ubuntu.
yii2 migrate command not working
yii migrate
I am getting Below error
php yii /var/www/event-tracking/migrate
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
Could not open input file: yii

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.
Execute the init command and select dev as environment.
php /path/to/yii-application/init
Create a new database and adjust the components.db configuration in common/config/main-local.php accordingly.
Apply migrations with console command:
yii migrate
or for windows:
php yii migrate
This command should create the table User,and Migration in your database
ref [Yii2 Documentation]

If yii migrate isn't working, you can also try php yii migrate as the yii command is just a PHP file that needs to be run.

This could happen if You clone the project from the git repo.
"yii" is added to .gitignore. Follow the instruction described in yii2 installation - migrate command not working
If You'are lazy of afraid to do it for some reasons, just copy "yii" file and /config/*-local.php files into Your project directory.

For init use following command on windows
c:\php /path of your yii application/init
For migration:
c:\php (path of your yii file which is in your application with file name) migrate
e.x:
c:\ php C:\xampp\htdocs\advanced\php migrate
advanced is a name of application.

you can use
php yii2 migrate
this worked for me

Just had this happen to me, CLI php uses a separate .ini, mine had errors supressed and a config file had a typo I just had to do
php -d display_errors=on yii
et voilĂ 

Error i was getting:-
user#mohit-pc:/var/www/html/yii2-app$ yii migrate --migrationPath=#mdm/admin/migrations
Command 'yii' not found, did you mean:
command 'ii' from deb ii
command 'yri' from deb yard
Try: sudo apt install <deb name>
Solution Go to the root of you Project and run the php yii migrate
user#mohit-pc:/var/www/html/yii2-app$ php yii migrate --migrationPath=#mdm/admin/migrations
Yii Migration Tool (based on Yii v2.0.43)
Creating migration history table "migration"...Done.
Total 2 new migrations to be applied:
m140602_111327_create_menu_table
m160312_050000_create_user
Apply the above migrations? (yes|no) [no]:yes
*** applying m140602_111327_create_menu_table
> create table {{%menu}} ... done (time: 0.041s)
*** applied m140602_111327_create_menu_table (time: 0.053s)
*** applying m160312_050000_create_user
> create table {{%user}} ... done (time: 0.034s)
*** applied m160312_050000_create_user (time: 0.050s)
2 migrations were applied.
Migrated up successfully.

Related

Yii2 Migration error - Unknown command: migrate\create Did you mean "migrate/create"?

I am learning database migration in Yii2. I am trying to create a new migration class create_news_table using command through composer.
I installed composer globally and running command
yii migrate/create create_news_table
I copied this command from yii2 official site Yii2 Db Migration
But after running command i got this error
Unknown command: migrate\create Did you mean "migrate/create"?
However i have written "migrate/create" not "migrate\create". Then why it is showing this error?
Please try this:
php yii migrate/create create_news_table
I was writing correct syntax. But the problem was with my composer.
I updated composer using composer update command and now it is working.
You have to escape / (slash). Try this:
yii migrate\/create create_news_table

Phalcon Dev Tools - Database migrations

I would like to know if phalcon php has a tool to create and apply migrations such as django has. I django I create my models and to create the migrations script I just have to type this command: python manage.py makemigrations app_name . And to apply migrations to my project: python manage.py migrate app_name
I would like to know if there is something with the same functinality on phalcon php. I have the phalcon dev tools 2.0.13 and I've been reading about the migration command but as far as I've read I couldn't find such functionality (or I'm not understanding).
Can you help me?
Thanks for any help
I have just found:
phalcon migration generate to create the migration files
phalcon migration run to apply the migration files to the database
Tips: create a .phalcon directory in the root of your project if you get this error message: Error: This command should be invoked inside a Phalcon project directory.
And in you config file set 127.0.0.1 instead of localhost if you get this error: ERROR: SQLSTATE[HY000] [2002] No such file or directory

Auth resources are missing in laravel

I want to make use of auth system which comes with the laravel package but the problem is when I make new laravel package using composer i.e composer create-project laravel/laravel project name --prefer-dist
it do not install those auth resources which includes (i.e. auth folder inside resources > views) and also I can't find the Services Folder inside app directory.
All other things are working fine except this authentication system.
What can be the possible problems? Please give me solution
I am working with MAMP.
Taylor Otwell has made it opt-in for Laravel 5.1
You need to run following command after installation
php artisan scaffold:auth
UPDATE
I think this has been answered here
You could also run the command php artisan make:auth in the root directory of you laravel project. I had the same problem and it worked for me.
The command php artisan scaffold:auth didn't work for me i don't know why.
it issued the error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "auth" is not defined.
Did you mean this?
make:auth
in Laravel 5.2 you just have to run this command "php artisan make:auth" and the auth folder will be created
Since laravel 6.* version make:auth is no longer supported, use ui:auth instead.
For deploying ui pack run
composer require laravel/ui --dev
then update composer.json :
composer update -W
and do the:
php artisan ui:auth
You need execute
php artisan make:auth
now if your style css and js are missing
You need load file .css and .js
1) execute in your project
npm install
2) then execute
npm run dev => now in folder /public now exist folder js and css
3) reload page

PHP YII framework Error: Unknown command "webapp"

I am trying to install Yii framework on windows XP in XAMPP. I am getting this error
Error: Unknown command "webapp".
I am using this command
yii webapp ../../myprojct
I have set the path as
SET PATH=D:\xampp\php
I am using the Yii 2
There is no webapp command anymore in yii2. Creating a project is done with composer create-project --prefer-dist yiisoft/yii2-app-basic basic.
Please refer to the official guide for instructions.
Download yii2 file from Yii2 Framework website and extract it htdocs.
then open the command prompt, use cd command to map the folder directory and finally use this command to install this
htdocs/foldername>php init
I hope this will help you, Thank You

ZFTool2 - Error Creating Project

I am new to the Zend Framework. I just started using ZFTool 2. The documentation says I can create a project by running the command
zf.php create project <path>
When I try to create a project
C:\wamp\www>zf.php create project quickstart
I encounter the following error
Error: I cannot find the autoloader of the application.
Check if C:\wamp\www contains a valid ZF2 application.
All other commands seem to work fine except the above. I wouldn't expect the command to be trying to find the autoloader of the application in my www folder anyway escpecially because am attempting to create a new project
EDIT:
The same thing also happens when i run the command
C:\wamp\www>zf.php version
When you use composer to install zftool then it will auto install into vendor\zendframework\zftool
So that, you only need cd to root of application and then point to folder ztool(example: your application folder that store in c:\xampp\htdocs\zend)
c:\xampp\htdocs\zend> php ./vendor/zendframework/zftool/zf.php version
It will output bellow:
ZFTool - Zend Framework 2 command line Tool
The ZFTool is using Zend Framework 2.5.1
and it'll work for you.
http://rao5s.vn

Categories