我試圖使這個example on php, mysql, and memcache作品。我把文件放在var/www/html
文件夾中。這是mc.php文件內容的頂部。MemCache對象沒有被實例化在一個PHP文件裏
<?php
echo "test 1";
$memcache = new Memcache;
echo "test 2";
...
?>
當我運行這個http://localhost/mc.php
在瀏覽器中,我得到了以下文字:test 1
。
很明顯,memcache對象沒有被瞬時化。但是,我已經安裝了memcached。當我在命令行運行這個命令時,我得到這個結果
user1: ~$ ps ax | grep memcached
1037 ? Sl 0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
2801 pts/1 S+ 0:00 grep --color=auto memcached
我是否缺少任何東西?
打開'display_errors' +設置'error_reporting'向你展示錯誤 – zerkms 2014-09-21 20:47:46
是的,我會打開它。我不知道它是默認關閉的。 – Richard77 2014-09-21 21:02:15