在命令行下我用PHP执行脚本不报错,但是我在网页上输出就报错
- PHP code
<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phperror_reporting(E_ERROR | E_WARNING | E_PARSE);$mem = new Memcache;$mem->connect("127.0.0.1", 11211);$re = $mem->set('testkey1','this is first value', 0, 60);var_export($re);$val = $mem->get('testkey1');echo "\r\n";echo "Get key1 value: " .$val. "\r\n";
上面的是我的代码
我用 php index.php 能执行脚本并且能得到正确的结果
但是我在浏览器里输入 http://site/index.php 竟然提示 “Class ‘Memcache’ not found in”
我的memcached都装了,而且重启了php和nginx
为什么在网页上会出错?? 这是为什么??
——解决方案——————–
2种执行方式载入的php.ini配置文件不同导致的。
网页查看phpinfo和命令行php –ini,看看是不是不同。
——解决方案——————–
或者是php.ini中,配置的扩展用的是本文来源gao@daima#com搞(%代@#码@网&搞gaodaima代码相对地址,extension_dir这个,还有一些其他的用相对地址也会出错。