该文章转载于 https://developer.baidu.com/forum/topic/show/6241
下载BCE PHP sdk后,运行报错:
Fatal error: Uncaught exception 'PharException' with message '__HALT_COMPILER(); must be declared in a phar' in
折腾了一天,最终在老外的论坛上找到了解决方法:主要是因为PHP环境开启了cache类的功能功能模块;
目前发现的主要有两种:xcache、eaccelerator这两种模块导致的;
解决方法:
1、卸载xcache、eaccelerator或者禁用这两种模块;
卸载xcache:在php.ini 中注释xcahche相应的extension行;
禁用eaccelerator:eaccelerator.ini文件中修改eaccelerator.enable="0";
扫描二维码关注公众号,回复:
6725672 查看本文章
2、添加相应的过滤策略:如果使用eaccelerator,可以在eaccelerator的配置文件中添加策略,不缓存phar文件;
eaccelerator.filter = "!*.phar"
eaccelerator配置参考链接:
https://github.com/eaccelerator/eaccelerator/wiki/Settings