简体   繁体   English

Laravel 5.5 \Memcache 未找到

[英]Laravel 5.5 \Memcache not Found

First: I tried 1#第一:我试过1#

I using Phpspreadsheet and LaravelExcel to make a import.我使用 Phpspreadsheet 和 LaravelExcel 进行导入。

I creating a new instance of Memcache (not MemcacheD) like the docs in PhpSpreadSheet says ( here ) and start a new import.我创建了一个新的 Memcache 实例(不是 MemcacheD),就像 PhpSpreadSheet 中的文档所说( 这里)并开始一个新的导入。 In local works fine after I make install all modules for php.在我为 php 安装所有模块后,在本地工作正常。 But in server (RH7 linux) laravel refuse to indentify the Memcache library.但在服务器(RH7 linux)laravel 拒绝识别 Memcache 库。

If I start the Tinker and initialize a new variable using new \Memcache();如果我启动 Tinker 并使用new \Memcache(); laravel found, but in runtime application don't.找到 laravel,但在运行时应用程序中没有。

Composer packages:作曲家包:

    "require": {
        "php": ">=7.0.0",
        "ext-json": "*",
        "adldap2/adldap2-laravel": "^3.0",
        "barryvdh/laravel-debugbar": "^2.3",
        "cache/memcache-adapter": "^1.0",
        "cache/memcached-adapter": "^1.0",
        "cache/simple-cache-bridge": "^1.0",
        "cocur/slugify": "^3.1",
        "doctrine/dbal": "^2.5",
        "geekcom/validator-docs": "^1.0",
        "laravel/dusk": "^1.0",
        "laravel/framework": ">=5.5",
        "laravel/tinker": "~1.0",
        "laravelcollective/html": "^5.3.0",
        "maatwebsite/excel": ">=3.1.13",
        "nwidart/laravel-modules": "^1.19",
        "watson/validating": "^3.0",
        "yajra/laravel-datatables-oracle": "~8.0",
        "zizaco/entrust": "5.2.x-dev"
    },

Some usefully info:一些有用的信息:

Php Modules installed: Php 安装的模块:

[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
intl
json
ldap
libxml
mbstring
memcache
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

在此处输入图像描述

Code:代码:

$client = new \Memcache();
        $client->connect('localhost', 11211);
        $pool = new \Cache\Adapter\Memcache\MemcacheCachePool($client);
        $simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);

        SpreadsheetSettings::setCache($simpleCache);
....

在此处输入图像描述

在此处输入图像描述

PHP uses 2 different php.ini files for php-cli and php-cgi (Fastcgi or Apache mod_php). PHP 使用 2 个不同的php.ini文件用于php-cliphp-cgi (Fastcgi 或 Apache mod_php)。 Sounds like your command line version php.ini has the require extension loading line added ie extension=memcache.so听起来您的命令行版本php.ini添加了需要扩展加载行,即extension=memcache.so

But your php-cgi version does not.但是你的php-cgi版本没有。 In any file add phpinfo();在任何文件中添加phpinfo(); and load it in web browser and locate Loaded Configuration File .并在 web 浏览器中加载它并找到Loaded Configuration File Append extension loading line ie extension=memcache.so to that file and restart the server. Append 扩展加载行,即extension=memcache.so到该文件并重新启动服务器。 Make sure that Memcache is listed in phpinfo();确保 Memcache 在phpinfo(); web page. web 页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM