laravel 運行錯誤

全局相關php

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 文件的內容】

功能相關mysql

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沒有權限laravel

解決方案:chmod -R 777 storageweb

cache錯誤redis

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

解決方案:sudo php artisan cache:clear數據庫

php composer.phar install報錯json

先安裝composer,而後運行php composer.phar install –no-scriptsbootstrap

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

[Dotenv\Exception\InvalidFileException]
Dotenv values containing spaces must be surrounded by quotes.

.env文件中文或者空格必須加引號

OpenSSL extension is required

打開php.ini啓用php_openssl

Key path 「file://storage\oauth-public.key」 does not exist or is not readable

php artisan passport:install

[Composer\Downloader\TransportException] 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

[Illuminate\Database\QueryException] 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 Illuminate\Support\Facades\Schema;

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

Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

C:\ProgramData\MySQL\MySQL Server 8.0\my.ini裏default_authentication_plugin=caching_sha2_password改default_authentication_plugin=mysql_native_password

exception:」InvalidArgumentException」
file:」C:\web\jinguan\vendor\laravel\framework\src\Illuminate\Http\JsonResponse.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

相關文章
相關標籤/搜索