以yii2為例
打包文件過程比較簡單,但打包好以后簡單測試yii命令,一直報錯:
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
一開始一直以為是打包出了問題有文件沒有被打包進去,換了各種姿勢去打包,還是報各種錯。
最后沒辦法的情況下,去看了報錯的這個文件,發現用了realpath來判斷路徑是否存在,注釋掉后,基本正常。這是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
新聞熱點
疑難解答