您好,我正在开发基于php laravel框架编写的cms和它的hase memcached缓存服务。
我需要将网站从可以运行memcached的虚拟服务器重新定位到新的主机,所以我需要禁用/避免memcache,因为使用memcached并没有那个么复杂。如何避免缓存和更改php文件。
以下是我的工作内容
指数php
<?php
$_PATH = __DIR__ . '/..';
require $_PATH . '/core/bootstrap/autoload.php';
$app = require_once $_PATH . '/core/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
?>
应用程序。php
<?php
$app = new ITDCMS\System\Foundation\Application(
realpath($_PATH)
);
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
ITDCMS\System\App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
ITDCMS\System\App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
ITDCMS\System\App\Exceptions\Handler::class
);
return $app;
?>
自动加载。php
<?php
define('ITDCMS_START', microtime(true));
require $_PATH.'/system/App/helpers.php';
require $_PATH.'/system/App/Common/Autoloader.php';
require $_PATH.'/vendor/autoload.php';
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}
?>
隐藏物php
<?php
return [
'default' => env('CACHE_DRIVER', 'file'),
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => data_path('cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
'prefix' => env('CACHE_PREFIX', 'app_'),
'lifetime' => [
'default' => 120
],
];
?>
MemcachedConnector
<?php
namespace Illuminate\Cache;
use Memcached;
use RuntimeException;
class MemcachedConnector
{
public function connect(array $servers)
{
$memcached = $this->getMemcached();
foreach ($servers as $server) {
$memcached->addServer(
$server['host'], $server['port'], $server['weight']
);
}
$memcachedStatus = $memcached->getVersion();
if (! is_array($memcachedStatus)) {
throw new RuntimeException('No Memcached servers added.');
}
if (in_array('255.255.255', $memcachedStatus) && count(array_unique($memcachedStatus)) === 1) {
throw new RuntimeException('Could not establish Memcached connection.');
}
return $memcached;
}
protected function getMemcached()
{
return new memcached;
}
}
我收到PHP致命错误:在/home/remi/domains/public\u html/vendor/laravel/framework/src/illighted/Cache/MemcachedConnector中找不到类“Memcached”。php在线51
事先非常感谢