w7corp / easywechat

📦 一个 PHP 微信 SDK
https://easywechat.com
MIT License
10.29k stars 2.4k forks source link

请问 Symfony\Component\Cache\Simple\FilesystemCache 这个类找不到怎么办 #1108

Closed malphitee closed 6 years ago

malphitee commented 6 years ago

如题,使用php7.0+laravel5.1的开发环境,wechat版本为4.0,服务器可以收到请求并回复,但尝试服务器主动向关注者发消息时报了这个错,google查找无果,大都要求安装symfony/finder这个包,安装后仍然没有效果,在laravel的vender目录下查找也没有发现symfony\component这个包,请问应该怎么解决?

malphitee commented 6 years ago

另:开始怀疑是laravel版本的问题,新建了一个laravel5.5的项目,也是这个问题

malphitee commented 6 years ago

报错信息:

FatalThrowableError in InteractsWithCache.php line 68:
Class 'Symfony\Component\Cache\Simple\FilesystemCache' not found

in InteractsWithCache.php line 68
at AccessToken->createDefaultCache() in InteractsWithCache.php line 46
at AccessToken->getCache() in AccessToken.php line 98
at AccessToken->getToken() in AccessToken.php line 204
at AccessToken->getQuery() in AccessToken.php line 168
at AccessToken->applyToRequest(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, 'retries' => '0')) in BaseClient.php line 228
at BaseClient->EasyWeChat\Kernel\{closure}(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, 'retries' => '0')) in RetryMiddleware.php line 67
at RetryMiddleware->__invoke(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, 'retries' => '0')) in PrepareBodyMiddleware.php line 66
at PrepareBodyMiddleware->__invoke(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 30
at Middleware::GuzzleHttp\{closure}(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in RedirectMiddleware.php line 70
at RedirectMiddleware->__invoke(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 59
at Middleware::GuzzleHttp\{closure}(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in HandlerStack.php line 67
at HandlerStack->__invoke(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Client.php line 277
at Client->transfer(object(Request), array('curl' => array('1'), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Client.php line 125
at Client->requestAsync('POST', object(Uri), array('curl' => array('1'), 'query' => array(), 'handler' => object(HandlerStack), 'synchronous' => true, 'timeout' => '5', 'base_uri' => object(Uri), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, '_conditional' => array('User-Agent' => 'GuzzleHttp/6.2.1 curl/7.47.0 PHP/7.0.22-0ubuntu0.16.04.1'))) in Client.php line 131
at Client->request('POST', 'cgi-bin/message/custom/send', array('curl' => array('1'), 'query' => array(), 'handler' => object(HandlerStack), 'headers' => array('Content-Type' => 'application/json'), 'body' => '{"msgtype":"text","touser":"xxxxxxxxxxxxxxx","text":{"content":"Hello world!"}}', 'synchronous' => true)) in HasHttpRequests.php line 150
at BaseClient->performRequest('cgi-bin/message/custom/send', 'POST', array('curl' => array('1'), 'query' => array(), 'handler' => object(HandlerStack), 'headers' => array('Content-Type' => 'application/json'), 'body' => '{"msgtype":"text","touser":"xxxxxxxxxxxxxxxxxxxxxx","text":{"content":"Hello world!"}}')) in BaseClient.php line 172
at BaseClient->request('cgi-bin/message/custom/send', 'POST', array('query' => array(), 'json' => array('msgtype' => 'text', 'touser' => 'xxxxxxxxxxxxxxxxxxx', 'text' => array('content' => 'Hello world!')))) in BaseClient.php line 103
at BaseClient->httpPostJson('cgi-bin/message/custom/send', array('msgtype' => 'text', 'touser' => 'xxxxxxxxxxxxxxxxx', 'text' => array('content' => 'Hello world!'))) in Client.php line 147
at Client->send(array('msgtype' => 'text', 'touser' => 'xxxxxxxxxxxxxxxxxxxxx', 'text' => array('content' => 'Hello world!'))) in Messenger.php line 148
at Messenger->send() in MessageController.php line 35
at MessageController->sendText()
at call_user_func_array(array(object(MessageController), 'sendText'), array()) in Controller.php line 256
at Controller->callAction('sendText', array()) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(MessageController), object(Route), 'sendText') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(MessageController), object(Route), object(Request), 'sendText') in ControllerDispatcher.php line 68
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\MessageController', 'sendText') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 674
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/data/wx/public/index.php') in index.php line 21
malphitee commented 6 years ago

到Symfony\Component\Cache\这一层都是有的,没有Simple和它下面的FilesystemCache

mingyoung commented 6 years ago

composer info symfony/cache 看看什么信息?

mingyoung commented 6 years ago

@malphitee 尝试下这样是否可以解决 #1109

malphitee commented 6 years ago

name : symfony/cache descrip. : Symfony implementation of PSR-6 keywords : caching, psr6 versions : * v3.2.14 type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText source : [git] https://github.com/symfony/cache.git b3245bf59f63852e187e0b296a0300d8671c6ecd dist : [zip] https://api.github.com/repos/symfony/cache/zipball/b3245bf59f63852e187e0b296a0300d8671c6ecd b3245bf59f63852e187e0b296a0300d8671c6ecd names : symfony/cache, psr/cache-implementation

autoload psr-4 Symfony\Component\Cache\ => . exclude-from-classmap

requires php >=5.5.9 psr/cache ~1.0 psr/log ~1.0

requires (dev) cache/integration-tests dev-master doctrine/cache ~1.6 doctrine/dbal ~2.4 predis/predis ~1.0

suggests symfony/polyfill-apcu For using ApcuAdapter on HHVM

provides psr/cache-implementation 1.0

mingyoung commented 6 years ago

@malphitee 更新一下 4.0.13

malphitee commented 6 years ago

我看那个commit是把cache版本改到3.3了,刚才我composer update了,好像还有点问题

  Problem 1
    - The requested package overtrue/laravel-wechat ~4.0.13 exists as overtrue/laravel-wechat[1.0-alpha, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 2.0.0, 2.0.0-alpha, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.1.1, 2.1.2, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.1.0, 3.1.1, 3.1.10, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, dev-master] but these are rejected by your constraint.

提示的这个

overtrue commented 6 years ago

@malphitee 你用的 composer 源有问题

malphitee commented 6 years ago

@overtrue 应该是源的问题,我用的中国镜像 http://www.phpcomposer.com/ 应该等一会就好了,待会来反馈哈,谢谢两位啦,反映好及时 @mingyoung @overtrue

overtrue commented 6 years ago

@malphitee 别用这个源了,它已经延迟一周多了

malphitee commented 6 years ago

@overtrue 0.0 有什么好的源推荐吗,还是直接用官方的就行?

overtrue commented 6 years ago

@malphitee 我在课程里讲了啊 https://laravel-china.org/composer

malphitee commented 6 years ago

@overtrue 好滴,这就换上,十分感谢哈

malphitee commented 6 years ago

不好意思,还得打扰一下,刚才我把源换成 https://packagist.laravel-china.org 这个了,composer config -l 看也确实是换过来了,然后我服务器上执行composer clear-cache, update,还是提示没有这个版本,无奈之下到vender/overtrue/wechat下的composer.json里手动对照刚才的commit进行了修改,然后用composer单独更新那一个包,结果好像也没反映,不知道有什么对策吗

malphitee commented 6 years ago

composer 中的require是这样的: "overtrue/laravel-wechat": "4.0.13", vender/overtrue/wechat中是这样的 :

        "symfony/psr-http-message-bridge": "^0.3|^1.0",
        "symfony/cache": "^3.3|^4.0",
        "easywechat-composer/easywechat-composer": "^0.1"
mingyoung commented 6 years ago

改回这样,composer update 即可,vendor 下面的你不用管 "overtrue/laravel-wechat": "^4.0"

malphitee commented 6 years ago

@mingyoung 不行啊,提示

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
malphitee commented 6 years ago

Nothing to install or update 。。。

mingyoung commented 6 years ago

rm composer.lock composer install

malphitee commented 6 years ago

试过了哇,还不行

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
malphitee commented 6 years ago

开始我也以为是缓存的问题,就删掉lock重新install,后来还composer clear-cache试了下也没用

overtrue commented 6 years ago

@malphitee 应该是源还没有更新,现在试一下,我看源是刚刚更新的

malphitee commented 6 years ago

@overtrue 试了还是不行。。。"overtrue/laravel-wechat": "^4.0" 就可以了对吧

malphitee commented 6 years ago

没更新下来东西

malphitee commented 6 years ago

服务器是东京节点,应该不会存在运营商缓存的因素,吧。。

overtrue commented 6 years ago

那你就用官方源咯

malphitee commented 6 years ago

。。。换了官方源删除composer.lock后install再更新还是不行,Nothing to install or update

malphitee commented 6 years ago
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://packagist.org
[process-timeout] 300
[use-include-path] false
xuejieming commented 6 years ago

最后怎解决的

xzmshiji commented 5 years ago

composer require symfony/cache

bonzaphp commented 1 year ago

sysmfony/cache:"^4.0"才会有这个类