本文主要是介绍window搭建php+yii2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
window搭建php+yii2
1. 在 Windows 中,你首先需要下载并运行 Composer-Setup.exe
2. Composer 安装后,切换到一个可通过 Web 访问的目录,执行如下命令即可安装 Yii :
3. 通过windows的’cmd’命令进入dos命令窗口,执行如下命令
composer global require “fxp/composer-asset-plugin:~1.2.1”
出现问题1:
报错:The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.解决: You should go to XAMPP php.ini and remove the semicolum from: extension=php_openssl.dll参考:https://teamtreehouse.com/community/openssl-extension-is-required
出现问题2:
报错:Deprecation Notice: The Composer\Package\LinkConstraint\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead . in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/LinkConstraint/MultiConstraint.php:17解决:composer global require "fxp/composer-asset-plugin:~1.0.0"修改成composer global require "fxp/composer-asset-plugin:~1.2.1"
composer create-project –prefer-dist –stability=dev yiisoft/yii2-app-advanced www.dh.com
出现问题3:
报错:Problem 1- yiisoft/yii2 2.0.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.- yiisoft/yii2 2.0.9 requires ext-mbstring * -> the requested PHP extensionmbstring is missing from your system.- yiisoft/yii2 2.0.8 requires ext-mbstring * -> the requested PHP extensionmbstring is missing from your system.- yiisoft/yii2 2.0.7 requires ext-mbstring * -> the requested PHP extensionmbstring is missing from your system.- yiisoft/yii2 2.0.6 requires ext-mbstring * -> the requested PHP extensionmbstring is missing from your system.- Installation request for yiisoft/yii2 ~2.0.6 -> satisfiable by yiisoft/yii2[2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.x-dev].To enable extensions, verify that they are enabled in those .ini files:- I:\android_developer\httpd2.4\php\php.iniYou can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.解决:找到php.ini打开extension=php_mbstring.dll参考文档:http://stackoverflow.com/questions/36979019/getting-error-while-update-composerhttp://stackoverflow.com/questions/32488917/composer-the-requested-php-extension-mbstring-is-missing-from-your-system
这篇关于window搭建php+yii2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!