LARAVEL踩坑

1、php artian xxx 需要严格区分环境

shell> php artisan config:cache --env=development
shell> php artisan config:cache --env=staging
shell> php artisan config:cache --env=production

2、清除缓存

shell> php artisan cache:clear
shell> php artisan config:clear

3、重新生成配置文件缓存,按默认环境

shell> php artisan config:cache

4、守护进程

shell> nohup php artisan messageQueue sysMessage pushSysMessage sysMessageQueue --env=staging &

以下并不是守护进程,只是后台进程,终端关闭,进程会被杀死

shell> php artisan messageQueue sysMessage pushSysMessage sysMessageQueue --env=staging &

5、migrate renamecolumn

[www@sx-stag shengxi]$ php artisan migrate --env=staging

   Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found

  at /home/wwwroot/shengxi/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php:65
    61|      * @return \Doctrine\DBAL\Driver\PDOMySql\Driver
    62|      */
    63|     protected function getDoctrineDriver()
    64|     {
  > 65|         return new DoctrineDriver;
    66|     }
    67|
    68|     /**
    69|      * Bind values to their parameters in the given statement.

  Exception trace:

  1   Illuminate\Database\MySqlConnection::getDoctrineDriver()
      /home/wwwroot/shengxi/vendor/laravel/framework/src/Illuminate/Database/Connection.php:884

  2   Illuminate\Database\Connection::getDoctrineSchemaManager()
      /home/wwwroot/shengxi/vendor/laravel/framework/src/Illuminate/Database/Connection.php:872

  Please use the argument -v to see more details.
[www@sx-stag shengxi]$ composer require doctrine/dbal
Using version ^2.9 for doctrine/dbal
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing doctrine/event-manager (v1.0.0): Downloading (100%)        
  - Installing doctrine/cache (v1.8.0): Downloading (100%)        
  - Installing doctrine/dbal (v2.9.1): Downloading (100%)        
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: dingo/api
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nunomaduro/collision
Discovered Package: tymon/jwt-auth
Package manifest generated successfully.
[www@sx-stag shengxi]$ php artisan migrate --env=staging
Migrating: 2018_12_20_094445_add_voice_cover_photo_to_user_detail
Migrated:  2018_12_20_094445_add_voice_cover_photo_to_user_detail
[www@sx-stag shengxi]$

Leave Comment

电子邮件地址不会被公开。 必填项已用*标注