0

让 Memcache 在我的服务器上工作时遇到了很多麻烦。

我有:

阿帕奇 2.4

PHP 5.5.11

内存缓存 3.0.8 ts vc11 x86

我已经放置了这条线:

extension=php_memcache.dll

在我正确加载且没有错误的 php.ini 文件中:

C:\Web Server\PHP>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\Web Server\PHP\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

如果我从我的 ext 目录中删除 php_memcache.dll 我会得到错误,所以它肯定会找到它并使用正确的 php.ini 文件。

当我运行我的测试页面时,它显示没有 memcache 模块详细信息的 php_info(),并且在该页面的底部我尝试创建一个新的 memcache 对象:

$M = new Memcache();

但我得到:

致命错误:第 5 行的 C:\Web Server\Apache24\htdocs\index.php 中找不到类“Memcache”

在过去的两天里,我一直在谷歌搜索并尝试不同的版本等,但没有成功。

我怎样才能让它工作?


更新

如果我使用命令行执行我的测试 php 文件,则不会出现错误,并且可以使用 Memcache 函数。

为什么我使用浏览器时不能正常工作?

4

1 回答 1

0

Well that was a pain in the arse.

Turns out I didn't put:

PHPIniDir "c:/Web Server/PHP/"

In my httpd.conf file, so it wasn't loading any php.ini file.

Once I did that it loaded the correct php.ini file and all my modules are now registered!

Hope this helps stop someone else tearing their hair out!

于 2014-04-15T10:52:22.800 回答