關於laravel 5.3 使用redis緩衝出現 找不到Class 'Predis\Client' not found的問題

來源:互聯網
上載者:User

標籤:response   []   pos   架構   設定   nal   eve   src   .com   

昨天使用5.3.版本的laravel架構開發公司新項目,發現將cache和session設定為了redis,執行了一下首頁訪問。

 

 laravel 版本號碼

 

簡單配置一下控制器路由,

Route::get(‘home‘, ‘[email protected]‘);
Route::get(‘/‘, ‘[email protected]‘);
怎麼配置控制器就不細說了。

說問題重點了(敲黑板!!!!!):

訪問出現錯誤!!!
說找不到一個類:找不到Class ‘Predis\Client‘ not
found

查了查源碼,發現少了一個vendor/目錄下少了一個包predis,
執行:composer require predis/predis 安裝這個包就好
註:版本<5.3可以成功解決問題。>5.3的,失敗!

控制台錯誤資訊如下:

Updating dependencies (including require-dev)
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package laravel/passport (locked at v1.0.0, required as 1.0.8) is satisfiable by laravel/passport[v1.0.0] but these conf
lict with your requirements or minimum-stability.
Problem 2
- Installation request for laravel/passport 1.0.8 -> satisfiable by laravel/passport[v1.0.8].
- laravel/passport v1.0.8 requires symfony/psr-http-message-bridge ^0.3.0 -> satisfiable by symfony/psr-http-message-bridge[v0.3] but th
ese conflict with your requirements or minimum-stability.


Installation failed, reverting ./composer.json to its original content.

 


中文翻譯:【更新的依賴(包括需要開發)
無法解碼的回應:zlib_decode():資料錯誤
重試與降級模式,檢查HTTPS:/ / getcomposer。org /檔案/物品/故障排除。MD #降級模式的更多資訊
你的要求不可能解決,對包的安裝設定。
問題1
-請求的包laravel /護照(鎖定在V1.0.0,需通過laravel 1.0.8)/護照[ V1.0.0 ]但這些配置可滿足
衝突與您的要求或最小穩定。
問題2
安裝要求laravel /護照1.0.8 ->滿足由laravel /護照[┊]。
- laravel /護照/ PSR symfony┊需要HTTP訊息橋^ 0.3.0┊->滿足由symfony / PSR HTTP訊息橋[ V0.3 ]但
這些衝突與您的要求或最小穩定。
安裝失敗,回複到原來的內容。/ composer.json。】

 

解決方案:[]中括弧中為可選項

修改 項目Conposer.json檔案 + 刪除Conposer.lock +[執行composer clearcache] + [執行composer update] +執行:composer require predis/predis

 

 

 

這個錯誤,我調試了很久,網上沒找到解決方案,所以花了很多時間才解決,具體是什麼原因,我也不能亂說。

總結一下錯誤原因:

  1. 使用redis才會報錯,如果你項目中沒用用系統提供的redis方法,就不會遇到。
  2. 版本問題,只要laravel 5.3.*才有這個問題,因為以前版本都可以直接執行composer require predis/predis 解決。
  3. predis 官網維護沒有及時更新 導致新版laravel 出現 請求的包laravel /passport (鎖定在V1.0.0,需通過laravel 1.0.8)/passport [ V1.0.0 ]
  4. 還麼想到,希望大家知道的補充,,,,,

 

先這樣吧,希望能幫到遇到同樣問題的同道。

 

原創部落格,轉載請註明出處!!!謝謝

 

====MING

關於laravel 5.3 使用redis緩衝出現 找不到Class 'Predis\Client' not found的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.