zoukankan      html  css  js  c++  java
  • laravel 运行错误

    全局相关

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    php artisan:显示详细的命令行帮助信息,同 php artisan list
    php artisan –help:显示帮助命令的使用格式,同 php artisan help
    php artisan –version:显示当前使用的 Laravel 版本
    php artisan changes:列出当前版本相对于上一版本的主要变化
    php artisan down:将站点设为维护状态
    php artisan up:将站点设回可访问状态
    php artisan optimize:优化应用程序性能,生成自动加载文件,且产生聚合编译文件 bootstrap/compiled.php
    php artisan dump-autoload:重新生成框架的自动加载文件,相当于 optimize 的再操作
    php artisan clear-compiled:清除编译生成的文件,相当于 optimize 的反操作
    php artisan migrate:执行数据迁移
    php artisan routes:列出当前应用全部的路由规则
    php artisan serve:使用 PHP 内置的开发服务器启动应用 【要求 PHP 版本在 5.4 或以上】
    php artisan tinker:进入与当前应用环境绑定的 REPL 环境,相当于 Rails 框架的 rails console 命令
    php artisan workbench 组织名/包名:这将在应用根目录产生一个名为 workbench 的文件夹,然后按 组织名/包名 的形式生成一个符合 Composer 标准的包结构,并自动安装必要的依赖【需要首先完善好 app/config/workbench.php 文件的内容】

    功能相关

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    php artisan cache:clear:清除应用程序缓存
    php artisan command:make 命令名:在 app/commands 目录下生成一个名为 命令名.php 的自定义命令文件
    php artisan controller:make 控制器名:在 app/controllers 目录下生成一个名为 控制器名.php 的控制器文件
    php artisan db:seed:对数据库填充种子数据,以用于测试
    php artisan key:generate:生成一个随机的 key,并自动更新到 app/config/app.ph 的 key 键值对
    php artisan migrate:install:初始化迁移数据表
    php artisan migrate:make 迁移名:这将在 app/database/migrations 目录下生成一个名为 时间+迁移名.php 的数据迁移文件,并自动执行一次 php artisan dump-autoload 命令
    php artisan migrate:refresh:重置并重新执行所有的数据迁移
    php artisan migrate:reset:回滚所有的数据迁移
    php artisan migrate:rollback:回滚最近一次数据迁移
    php artisan session:table:生成一个用于 session 的数据迁移文件

    laravel 500错误是storage没有权限

    解决方案:chmod -R 777 storage

    cache错误

    file_put_contents(/..cache/services.json): failed to open stream: Permission denied

    解决方案:sudo php artisan cache:clear

    php composer.phar install报错

    先安装composer,然后运行php composer.phar install –no-scripts

    PDO错误,已安装PDO还提示

    [PDOException]
    SQLSTATE[HY000] [2002] No such file or directory

    解决方案:将.env下的DB_HOST=localhost改为DB_HOST=127.0.0.1

    SQLSTATE[HY000] [1045]

    解决方案:
    php artisan cache:clear
    php artisan config:clear

    php artisan 没反应

    composer dumpautoload

    The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

    php artisan key:generate

    [DotenvExceptionInvalidFileException]
    Dotenv values containing spaces must be surrounded by quotes.

    .env文件中文或者空格必须加引号

    OpenSSL extension is required

    打开php.ini启用php_openssl

    Key path “file://storageoauth-public.key” does not exist or is not readable

    php artisan passport:install

    [ComposerDownloaderTransportException] The “https://packagist.phpcomposer.com/p/provider-2017-07%24c3e8d929d5d06fa b76cef9c5b5e4305dbe89c1599b79e63eee70490a6b8df914.json” file could not be d ownloaded (HTTP/1.1 404 Not Found)

    composer diagnose

    [ErrorException] proc_open(): fork failed – Cannot allocate memory

    /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024

    /sbin/mkswap /var/swap.1

    /sbin/swapon /var/swap.1

    LogicException Key path “file:///storage/oauth-public.key” does not exist or is not readable

    chown www-data:www-data storage/oauth-*.key

    chmod 600 storage/oauth-*.key

    [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

    AppServiceProvider.php

    use IlluminateSupportFacadesSchema;
    
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

    IlluminateDatabaseQueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

    C:ProgramDataMySQLMySQL Server 8.0my.ini里default_authentication_plugin=caching_sha2_password改default_authentication_plugin=mysql_native_password

    exception:”InvalidArgumentException”
    file:”C:webjinguanvendorlaravelframeworksrcIlluminateHttpJsonResponse.php”
    line:75
    message:”Malformed UTF-8 characters, possibly incorrectly encoded”

    Event::fire错误是redis没开

    Class session does not exist

    chmod -R 777 bootstrap/cache

    Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)

    php.ini打开扩展

    extension=fileinfo

  • 相关阅读:
    用Fiddle跟踪调试移动表单
    查找指定表、字段上面的默认值约束
    sql跳过非工作日(周末和节假日)
    python学习(一)
    charles抓包
    jemeter简单压测
    jemeter接口测试
    postman接口测试
    接口测试基础知识学习
    定期小结
  • 原文地址:https://www.cnblogs.com/hjcan/p/10646200.html
Copyright © 2011-2022 走看看