在命令行下小弟我用PHP执行脚本不报错,但是小弟我在网页上输出就报错

WBOY
Release: 2016-06-13 10:04:30
Original
862 people have browsed it

在命令行下我用PHP执行脚本不报错,但是我在网页上输出就报错

PHP code
<!--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";
Copy after login

上面的是我的代码
我用 php index.php 能执行脚本并且能得到正确的结果
但是我在浏览器里输入 http://site/index.php 竟然提示 "Class 'Memcache' not found in"

我的memcached都装了,而且重启了php和nginx

为什么在网页上会出错?? 这是为什么??

------解决方案--------------------
2种执行方式载入的php.ini配置文件不同导致的。
网页查看phpinfo和命令行php --ini,看看是不是不同。
------解决方案--------------------
或者是php.ini中,配置的扩展用的是相对地址,extension_dir这个,还有一些其他的用相对地址也会出错。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template