Phinx seeds won't run after upgrade to php7.0 - php

I have a bunch of Phinx seeds which used to run fine
php vendor/bin/phinx seed:run
My seeds are located in var/www/html/db/seeds folder
I recently upgraded my VM to php 7.0 (Also upgraded to 16.04 LTS box), now I get the following output & error when I try to run phinx seeds:
ubuntu#ubuntu-xenial:/var/www/html$ sudo vendor/bin/phinx seed:run
Phinx by Rob Morgan - https://phinx.org. version 0.5.4
using config file ./phinx.yml
using config parser yaml
using migration path /var/www/html/db/migrations
using seed path /var/www/html/db/seeds
warning no environment specified, defaulting to: development
using adapter mysql
using database closecall
[InvalidArgumentException]
The seed class "" does not exist
To reiterate, seeds were running fine, upgraded to php 7.0 and now they're not.
Migrations still run completely fine, however.
I've removed all seeds bar one:
<?php
use Phinx\Seed\AbstractSeed;
class CategorySeeder extends AbstractSeed
{
public function run()
{
$data = array(
array(
'name' => 'Confined Spaces'
)
);
}
}
To debug with, still gives the same error.

Try:
php vendor/bin/phinx seed:run -s CategorySeeder

Related

Cannot create a user in Voyager (laravel 6.x)

I've installed the admin package Voyager (without dummy data) on my Laravel project and when I want to create a user to access the admin panel with the following command: php artisan voyager:admin admin#admin.com --create, I get the following error:
After a little bit of searching, I found this link: https://github.com/the-control-group/voyager/issues/5082 => saying that this command does not work with PHP 7.4 and to make it work, I should either upgrade to PHP 7.4.1 or downgrade to PHP 7.3.
I'm using Wamp Server and decided to downgrade to PHP 7.3.12 since this version exists by default in C:\wamp64\bin\php
I have also edited composer.lock and composer.json in my project and then ran the command composer dump-autoload. But it still doesn't work. Am I missing something?
Had the same issue, upgraded to php 7.4.27 and it worked.

Enquiries - Laravel website migration steps

I got a website running with laravel framework, this website will need to migrate to public cloud VM. However, I'm not quite familiar with laravel, any suggestion and advice would be appreciated.
I already created a remote VM, and installed Nginx.
Also, I move the root folder from on-prem /var/wwwroot to the cloud /var/wwwroot as well. Moreover, the Mysql database had been imported to the cloud Mysql too (using the dumped .sql file ).
laravel need PHP to run, should I install php5.6 or php5.6-fpm (or both)?
I need to install laravel framework, do I have to install the specific version of lavavel (5.1.46)?
After I install the laravel, do I need to conduct any laravel command such as
~#php artisan migrate ? or just put the wwwroot folder's file should be enough?
Here is more info about the on-prem VM:
~#php --version
PHP 5.6.32-1+ubuntu16.04.1+deb.sury.org+1 (cli)
~#nginx -v
nginx version: nginx/1.13.6
~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
~# php artisan --version
Laravel Framework version 5.1.46 (LTS)
~# mysqld --version
mysqld Ver 5.7.20-0ubuntu0.16.04.1 for Linux on x86_64 ((Ubuntu))
Tony.
You want to use NGINX as webserver, so you need to install both packages.
If you install your code from git, you should install dependencies by running command:
php composer install
You should create your .env-file and edit it: set up db connection params and other settings:
cp .env.example .env
Also you should generate app key:
php artisan key:generate
If you copied last version of your db, you don't need to run up migrations, but I recommend you to run new migrations, to be confident that db structure wasn't changed since you make dump.
php artisan migrate

Laravel 5.7 upgrade, Uncaught ReflectionException: Class cache does not exist Container.php:779

When upgrading Laravel 5.5 to 5.7 and running composer install I see this error.
Has any one else experienced something similar?
I also upgraded php from 7.1 to 7.2 at the same time using forge, after reverting the code to laravel 5.5 staying with php 7.2 was not an issue.
There were changes from Laravel 5.6 to 5.7 that might have caused this:
From the Upgrade Notes:
A new data directory has been added to storage/framework/cache. You should create this directory in your own application:
mkdir -p storage/framework/cache/data
Then, add a .gitignore file to the newly created data directory:
cp storage/framework/cache/.gitignore storage/framework/cache/data/.gitignore
Finally, ensure that the storage/framework/cache/.gitignore file is updated as follows:
*
!data/
!.gitignore
There was also a change from Laravel 5.5 to 5.6, but from what it looks like this seems unlikely to be the cause.

Testing Database using laravel dusk

I am testing my laravel application using laravel dusk but the problem is that I am unable to use assertDatabaseHasfunction. When I run php artisan dusk command I got this error:
PHP Fatal error: Class 'PHPUnit_Framework_Constraint' not found in
vendor\laravel\framework\src\Illuminate\Foundation\Testing\Constraints\HasIn
Database.php on line 8
Here is my code:
$this->assertDatabaseHas('teams', [
'name' => $data['team_name'],
]);
Please check your version of phpunit:
phpunit --version
If you are are running v6 you might have trouble because it expects a namespaced class. In that case you either have to switch to an older version of phpunit, e.g. locally installed for your project and then run like this:
php vendor/bin/phpunit --version
or you might have to update your Laravel-project, which is probably more work as you might have to change parts of your code.

yii2 installation - migrate command not working

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.

Categories