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