Yii2 framework packaging into a Phar package reports an error

Source: Internet
Author: User
: This article describes how to report an error when the Yii2 framework is packaged into a Phar package. For more information about PHP tutorials, see. Take yii2 as an example

The file packaging process is relatively simple, but after packaging, the following error is reported:

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 packaging problem. some files were not packed in. I changed the packaging posture and reported various errors.

Finally, I checked the file with an error and found that realpath was used to determine whether the path exists. after commenting out the file, it is 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 introduces the Yii2 framework packaging into a Phar package error reporting experience, including some content, hope to be helpful to friends interested in PHP tutorials.

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.