簡體   English   中英

如何使Apigility正常工作?

[英]How to get Apigility working correctly?

我正在在Linux Web服務器上安裝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時經歷過此事,或者知道如何解決此問題?

原來我不是最新的PHP。 更新到PHP5.5,它起作用了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM