Yii2 framework packaged into a PHAR Packet error experience

Source: Internet
Author: User
Tags yii
Taking Yii2 as an example

The process of packaging files is simple, but after packaging, always error:

PHP Fatal error:uncaught yii\base\invalidparamexception:the directory does not exist:phar:///users/jimmy/php/library/ Yii2-advanced/yii2.phar/console in phar:///users/jimmy/php/library/yii2-advanced/yii2.phar/base/module.php:224

At first, I thought it was a problem. There are files that have not been packed in, changed in various poses to pack, or reported all kinds of mistakes.

Finally there is no way to see the error of the file, found that the Realpath to determine whether the path exists, commented out, basically normal. This is a PHP bug.

/** * Sets the root directory of the module. * This method can only be invoked at the beginning of the constructor. * @param string $path the root directory of the module. This can be either a directory name or a path alias. * @throws InvalidParamException if the directory does not exist. */public function setBasePath($path){    $path = Yii::getAlias($path);    $p = $path;//realpath();    if ($p !== false && is_dir($p)) {        $this->_basePath = $p;    } else {        throw new InvalidParamException("The directory does not exist: $path");    }}

Http://git.oschina.net/web3d/codes/zyhsoev0b3i9u5njgaf42

The above describes the YII2 framework package into the Phar Package error experience, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.