php7.2 使用 webman , 出现无法使用数据库的问题, php7.2 库依赖似乎有巨大问题

askuiop

问题描述

php 版本 7.2.34
webman 版本:
workerman/webman-framework v1.5.11
workerman/workerman v4.1.13

安装数据库相关库:
composer require -W illuminate/database illuminate/pagination illuminate/events symfony/var-dumper

安装的库:
illuminate/container v7.30.6 The Illuminate Container package.
illuminate/contracts v7.30.6 The Illuminate Contracts package.
illuminate/database v7.30.6 The Illuminate Database package.
illuminate/events v7.30.6 The Illuminate Events package.
illuminate/pagination v7.30.6 The Illuminate Pagination package.
illuminate/support v7.30.6 The Illuminate Support package.

运行时, 出现错误:

Error: Class 'Illuminate\Pagination\CursorPaginator' not found in /xxxxxxx/vendor/workerman/webman-framework/src/support/bootstrap/LaravelDb.php:116

illuminate/pagination v10 就存在CursorPaginator 这个类, 但是 php7.2 无法安装 v10 版本.

php7.2 使用 webman 的话 , 如何能使用上数据库 ?

669 4 1
4个回答

Tinywan

安装依赖包后需要重新加载一下代码的。

  • askuiop 2023-11-15

    php start.php restart ? 自然是有的, 不是这个问题, 是库版本的问题

  • Tinywan 2023-11-15

    你这是类都找不到

SillyDog

你好歹看下 illuminate/pagination v10版本php版本要求啊 😅

  • askuiop 2023-11-15

    php 7.2 装不了illuminate/pagination v10, 但是 php7.2 webman 却要求 v10 版本, 请问怎么办?

  • SillyDog 2023-11-15

    你要不自己看看 webman 的composer.json哪里有写 illuminate/pagination v10 ?
    https://github.com/walkor/webman/blob/master/composer.json

  • SillyDog 2023-11-15

    你先明白你在做什么

  • SillyDog 2023-11-15

    你先捋一下 具体是其他库里边要求的 还是webman 要求的? 如果是依赖要求的 降低依赖库的版本

  • askuiop 2023-11-15

    php7.2 的 webman 却要求 illuminate/pagination v10 版本, 但是 php7.2 只能安装 v7 版本, v10 版本是我用php8.1 安装得出, 但是只能用 php7.2

  • askuiop 2023-11-15

    php7.2 的 webman 兼容上就是有问题 !!!

  • SillyDog 2023-11-15

    你从php8.2 换成 php7.2 你删除composer.lock了嘛 ?😅

  • SillyDog 2023-11-15

    人呢?

  • askuiop 2023-11-15

    2台机器呀, 因为 php7.2 不行, 才用另一台php8.1 的设备测的

  • SillyDog 2023-11-15

    你本来是在那个php版本下开发的?

  • SillyDog 2023-11-15

    干净的webman 是没有 orm这些库的 只有自己添加的库 如果你本来就是在8.*下开发 你扔到7.2上 这是本来就不行的 你用那个框架都不行

  • Tinywan 2023-11-15

    直接安装一个空框架跑一把!看看是哪里问题

  • askuiop 2023-11-15

    哎, 说的很清楚了 , php7.2 才是目标. php8.1 是另外一台机器, 出问题后才用这台测的.

  • askuiop 2023-11-15

    谁会无聊乱切换版本呢???

  • SillyDog 2023-11-15

    开发版本是多少?

nitron

webman-framework v1.5.9 没你说的这个问题
webman-framework v1.5.10 及以上才更新的LaravelDb.php,需要Illuminate\Pagination\CursorPaginator和Illuminate\Pagination\Cursor

  • askuiop 2023-11-15

    奇怪, 两次 composer show 的结果不同, 之前看确实 v1.5.9, 刚才查看一次命令是 v1.5.11
    workerman/webman-framework v1.5.11
    workerman/workerman v4.1.13

  • askuiop 2023-11-15

    使用 v1.5.9 就可以的是吧 ?

    但是 php7.2 确实安装了 v1.5.11 这个兼容有问题的版本 , 这不合理呀

  • askuiop 2023-11-15

    php72 ./composer create-project workerman/webman
    Creating a "workerman/webman" project at "./webman"
    Installing workerman/webman (v1.5.4)

    • Installing workerman/webman (v1.5.4): Extracting archive
      Created project in /home/jims/wwwroot/JB_work/DISC_Test_xcx/webman
      Loading composer repositories with package information
      Updating dependencies
      Lock file operations: 6 installs, 0 updates, 0 removals
    • Locking monolog/monolog (2.9.2)
    • Locking nikic/fast-route (v1.3.0)
    • Locking psr/container (2.0.1)
    • Locking psr/log (1.1.4)
    • Locking workerman/webman-framework (v1.5.11)
    • Locking workerman/workerman (v4.1.13)
      Writing lock file
      Installing dependencies from lock file (including require-dev)
      Package operations: 6 installs, 0 updates, 0 removals
    • Installing psr/log (1.1.4): Extracting archive
    • Installing monolog/monolog (2.9.2): Extracting archive
    • Installing workerman/workerman (v4.1.13): Extracting archive
    • Installing psr/container (2.0.1): Extracting archive
    • Installing nikic/fast-route (v1.3.0): Extracting archive
    • Installing workerman/webman-framework (v1.5.11): Extracting archive

      support\Plugin::install
      support\Plugin::install
      support\Plugin::install
      support\Plugin::install
      support\Plugin::install
      support\Plugin::install
      Create start.php
      Create windows.php
      Create support/bootstrap.php
      Create support/helpers.php
      14 package suggestions were added by new dependencies, use composer suggest to see details.
      Generating autoload files
      2 packages you are using are looking for funding.
      Use the composer fund command to find out more!
      No security vulnerability advisories found

  • askuiop 2023-11-15

    php72 ../composer show
    monolog/monolog 2.9.2 Sends your logs to files, sockets, inboxes, databases and various web services
    nikic/fast-route v1.3.0 Fast request router for PHP
    psr/container 2.0.1 Common Container Interface (PHP FIG PSR-11)
    psr/log 1.1.4 Common interface for logging libraries
    workerman/webman-framework v1.5.11 High performance HTTP Service Framework.
    workerman/workerman v4.1.13 An asynchronous event driven PHP framework for easily building fast, scalable network applications.

  • askuiop 2023-11-15

    确实安装是 v1.5.11 , 这不就有问题了嘛

  • askuiop 2023-11-15

    这是为什么?

Chance

已修复,等 1.5.12 版本发布以后,重新安装一下依赖

×
🔝