今天打算学习一下Yii,但是在安装过程中出现了很多问题。

通过composer安装:

composerglobalrequire"fxp/composer-asset-plugin:~1.1.1"composercreate-project--prefer-distyiisoft/yii2-app-basicbasic

第一条命令安装Composer asset plugin,它是通过 Composer 管理 bower 和 npm 包所必须的,此命令全局生效,一劳永逸。 第二条命令会将 Yii 安装在名为basic的目录中,你也可以随便选择其他名称。

但是在安装过程中就报了一个异常如下:

[Symfony\Component\Process\Exception\RuntimeException]TheProcessclassreliesonproc_open,whichisnotavailableonyourPHPinstallation.


解决方法:

  在php.ini中,找到disable_functions选项,看看后面是否有proc_open函数被禁用了,如果有的话,去掉即可。

希望对大家有所帮助。

然而删除之后,又报了异常

[ErrorException]proc_get_status()hasbeendisabledforsecurityreasons

同样道理,proc_get_status被禁用了,只要把proc_get_status删了即可。

错误还在继续。。。

Couldnotfetchhttps://api.github.com/repos/jquery/jquery-dist,pleasecreateaGitHubOAuthtokentogoovertheAPIratelimitHeadtohttps://github.com/settings/tokens/new?scopes=repo&description=Composer+on+gcan+2017-07-12+0045toretrieveatoken.Itwillbestoredin"/home/gcan/.config/composer/auth.json"forfutureusebyComposer.Token(hidden):*****************************

在github的setting/Personal access tokens下面建立token,然后直接将token复制粘贴放到Token (hidden): ***后面即可。


回车后如果出现

Token stored successfully.

表示token验证成功。

下面是安装进程:

Installingyiisoft/yii2-app-basic(2.0.12)-Installingyiisoft/yii2-app-basic(2.0.12):LoadingfromcacheCreatedprojectinbasicLoadingcomposerrepositorieswithpackageinformationUpdatingdependencies(includingrequire-dev)Couldnotfetchhttps://api.github.com/repos/jquery/jquery-dist,pleasecreateaGitHubOAuthtokentogoovertheAPIratelimitHeadtohttps://github.com/settings/tokens/new?scopes=repo&description=Composer+on+gcan+2017-07-12+0045toretrieveatoken.Itwillbestoredin"/home/gcan/.config/composer/auth.json"forfutureusebyComposer.Token(hidden):b47aa5ca176ba184674369be830bd3fe8daaf584Tokenstoredsuccessfully.Packageoperations:59installs,0updates,0removals-Installingyiisoft/yii2-composer(2.0.5):Downloading(100%)-Installingswiftmailer/swiftmailer(v5.4.8):Downloading(100%)-Installingbower-asset/jquery(2.2.4):Downloading(100%)-Installingbower-asset/yii2-pjax(v2.0.6):Downloading(100%)-Installingbower-asset/punycode(v1.3.2):Downloading(100%)-Installingcebe/markdown(1.1.1):Downloading(100%)-Installingezyang/htmlpurifier(v4.9.3):Downloading(100%)-Installingbower-asset/jquery.inputmask(3.3.7):Downloading(100%)-Installingyiisoft/yii2(2.0.12):Downloading(100%)-Installingyiisoft/yii2-swiftmailer(2.0.7):Downloading(100%)-Installingbower-asset/bootstrap(v3.3.7):Downloading(100%)-Installingyiisoft/yii2-bootstrap(2.0.6):Downloading(100%)-Installingyiisoft/yii2-debug(2.0.9):Downloading(100%)-Installingbower-asset/typeahead.js(v0.11.1):Downloading(100%)-Installingphpspec/php-diff(v1.1.0):Downloading(100%)-Installingyiisoft/yii2-gii(2.0.5):Downloading(100%)-Installingfzaninotto/faker(v1.6.0):Downloading(100%)-Installingyiisoft/yii2-faker(2.0.3):Downloading(100%)-Installingpsr/log(1.0.2):Downloading(100%)-Installingsymfony/debug(v3.3.4):Downloading(100%)-Installingsymfony/polyfill-mbstring(v1.4.0):Downloading(100%)-Installingsymfony/console(v3.3.4):Downloading(100%)-Installingstecman/symfony-console-completion(0.7.0):Downloading(100%)-Installingsebastian/diff(1.4.3):Downloading(100%)-Installingsebastian/recursion-context(2.0.0):Downloading(100%)-Installingsebastian/exporter(2.0.0):Downloading(100%)-Installingsebastian/comparator(1.2.4):Downloading(100%)-Installingbehat/gherkin(v4.4.5):Downloading(100%)-Installingsymfony/dom-crawler(v3.3.4):Downloading(100%)-Installingsymfony/css-selector(v3.3.4):Downloading(100%)-Installingsymfony/browser-kit(v3.3.4):Downloading(100%)-Installingsymfony/yaml(v3.3.4):Downloading(100%)-Installingsymfony/event-dispatcher(v3.3.4):Downloading(100%)-Installingsymfony/finder(v3.3.4):Downloading(100%)-Installingpsr/http-message(1.0.1):Downloading(100%)-Installingguzzlehttp/psr7(1.4.2):Downloading(100%)-Installingdoctrine/instantiator(1.0.5):Downloading(100%)-Installingphpunit/php-text-template(1.2.1):Downloading(100%)-Installingphpunit/phpunit-mock-objects(3.4.4):Downloading(100%)-Installingsebastian/version(2.0.1):Downloading(100%)-Installingsebastian/code-unit-reverse-lookup(1.0.1):Downloading(100%)-Installingphpunit/php-token-stream(1.4.11):Downloading(100%)-Installingphpunit/php-file-iterator(1.4.2):Downloading(100%)-Installingsebastian/environment(2.0.0):Downloading(100%)-Installingphpunit/php-code-coverage(4.0.8):Downloading(100%)-Installingsebastian/resource-operations(1.0.0):Downloading(100%)-Installingsebastian/global-state(1.1.1):Downloading(100%)-Installingphpunit/php-timer(1.0.9):Downloading(100%)-Installingwebmozart/assert(1.2.0):Downloading(100%)-Installingphpdocumentor/reflection-common(1.0):Downloading(100%)-Installingphpdocumentor/type-resolver(0.2.1):Downloading(100%)-Installingphpdocumentor/reflection-docblock(3.1.1):Downloading(100%)-Installingphpspec/prophecy(v1.7.0):Downloading(100%)-Installingmyclabs/deep-copy(1.6.1):Downloading(100%)-Installingsebastian/object-enumerator(2.0.1):Downloading(100%)-Installingphpunit/phpunit(5.7.21):Downloading(100%)-Installingcodeception/base(2.3.4):Downloading(100%)-Installingcodeception/verify(0.3.3):Downloading(100%)-Installingcodeception/specify(0.4.6):Downloading(100%)symfony/consolesuggestsinstallingsymfony/filesystem()symfony/consolesuggestsinstallingsymfony/process()symfony/browser-kitsuggestsinstallingsymfony/process()symfony/event-dispatchersuggestsinstallingsymfony/dependency-injection()symfony/event-dispatchersuggestsinstallingsymfony/http-kernel()phpunit/php-code-coveragesuggestsinstallingext-xdebug(^2.5.1)sebastian/global-statesuggestsinstallingext-uopz(*)phpunit/phpunitsuggestsinstallingphpunit/php-invoker(~1.1)phpunit/phpunitsuggestsinstallingext-xdebug(*)codeception/basesuggestsinstallingflow/jsonpath(ForusingJSONPathinRESTmodule)codeception/basesuggestsinstallingphpseclib/phpseclib(forSFTPoptioninFTPModule)codeception/basesuggestsinstallingleague/factory-muffin(ForDataFactorymodule)codeception/basesuggestsinstallingleague/factory-muffin-faker(ForFakersupportinDataFactorymodule)codeception/basesuggestsinstallingsymfony/phpunit-bridge(Forphpunit-bridgesupport)WritinglockfileGeneratingautoloadfiles>yii\composer\Installer::postCreateProjectchmod('runtime',0777)...done.chmod('web/assets',0777)...done.chmod('yii',0755)...done.

当访问http://localhost/basic/web/index.php时,如果能正常显示附件页面,说明Yii成功安装了