如何让Apigility正常工作?

时间:2016-06-11 04:13:37

标签: php apigility

我正在Linux网络服务器上安装Apigility。它是Inmotion Hosting的共享主机帐户。我正在使用https://apigility.org/documentation/intro/installation处的说明。这很容易安装,但我遇到了一些我无法弄清楚的语法错误。

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/amlcon5/public_html/websites/dev/apigility/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 281

这是来自ServiceManager.php的函数,其中错误是。

/**
 * Set factory
 *
 * @param  string                           $name
 * @param  string|FactoryInterface|callable $factory
 * @param  bool                             $shared
 * @return ServiceManager
 * @throws Exception\InvalidArgumentException
 * @throws Exception\InvalidServiceNameException
 */
public function setFactory($name, $factory, $shared = null)
{
    $cName = $this->canonicalizeName($name);

    if (!($factory instanceof FactoryInterface || is_string($factory) || is_callable($factory))) {
        throw new Exception\InvalidArgumentException(sprintf(
            'Provided factory must be the class name of a factory, callable or an instance of "%s".',
            FactoryInterface::class // <--- ERROR IS HERE
        ));
    }

    if ($this->has([$cName, $name], false)) {
        if ($this->allowOverride === false) {
            throw new Exception\InvalidServiceNameException(sprintf(
                'A service by the name or alias "%s" already exists and cannot be overridden, please use an alternate name',
                $name
            ));
        }
        $this->unregisterService($cName);
    }

    if ($shared === null) {
        $shared = $this->shareByDefault;
    }

    $this->factories[$cName] = $factory;
    $this->shared[$cName]    = (bool) $shared;

    return $this;
}

我尝试过多种方法,例如:使用其他方法重新安装,禁用OpCache以及查看配置文件。

有没有人在设置Apigility或知道如何解决这个问题时遇到过这个问题?

1 个答案:

答案 0 :(得分:0)

原来我在PHP上没有达到最新状态。更新到PHP5.5,它的工作原理。