: 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.