最近項目須要,學習了一下yii2.0框架php
第一步: 安裝composer--------做爲一個phper composer不會用可能有點不合適css
下載composer.phar文件 #curl -sS https://getcomposer.org/installer | php出現表示下載成功. 運行 php composer.phar 會出現composer的標誌。 php composer.phar 移動或複製composer.phar 到系統 bin 目錄 #mv composer.phar /usr/local/bin/composer #cp composer.phar /usr/local/bin/composer 修改composer文件的權限 #chmod 744 /usr/local/bin/composer
第二步:從git分支上拉取代碼html
#git clone http://yourservername/basic.git
第三部:安裝yii的核心庫nginx
進入你的git clone的網站根目錄執行: #composer install
若是執行install失敗,出現git
Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0]. - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 2 - Installation request for myclabs/deep-copy 1.8.1 -> satisfiable by myclabs/deep-copy[1.8.1]. - myclabs/deep-copy 1.8.1 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 3 - Installation request for symfony/browser-kit v4.2.4 -> satisfiable by symfony/browser-kit[v4.2.4]. - symfony/browser-kit v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 4 - Installation request for symfony/console v4.2.4 -> satisfiable by symfony/console[v4.2.4]. - symfony/console v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 5 - Installation request for symfony/contracts v1.0.2 -> satisfiable by symfony/contracts[v1.0.2]. - symfony/contracts v1.0.2 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 6 - Installation request for symfony/css-selector v4.2.4 -> satisfiable by symfony/css-selector[v4.2.4]. - symfony/css-selector v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 7 - Installation request for symfony/dom-crawler v4.2.4 -> satisfiable by symfony/dom-crawler[v4.2.4]. - symfony/dom-crawler v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 8 - Installation request for symfony/event-dispatcher v4.2.4 -> satisfiable by symfony/event-dispatcher[v4.2.4]. - symfony/event-dispatcher v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 9 - Installation request for symfony/finder v4.2.4 -> satisfiable by symfony/finder[v4.2.4]. - symfony/finder v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 10 - Installation request for symfony/yaml v4.2.4 -> satisfiable by symfony/yaml[v4.2.4]. - symfony/yaml v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. Problem 11 - symfony/browser-kit v4.2.4 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement. - codeception/base 2.3.9 requires symfony/browser-kit >=2.7 <5.0 -> satisfiable by symfony/browser-kit[v4.2.4]. - Installation request for codeception/base 2.3.9 -> satisfiable by codeception/base[2.3.9].
說明php版本問題執行:web
composer install --ignore-platform-reqs
這樣 yii框架就安裝好了yii2
而後進入你的nginx配置文件 找到nginx.conf 配置一個servercomposer
#能夠直接複製 將servername改爲本身的 yourpath 改爲項目實際地址便可
server { charset utf-8; client_max_body_size 128M; listen 80; server_name yourservername; root /yourpath/web; index index.php index.html; access_log /yourpath/log/access.log; error_log /yourpath/log/error.log; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; try_files $uri =404; } location ~* /\. { deny all; } }
而後重啓nginx框架
訪問你本身配置的域名 出現下面的頁面說明yii已經部署完畢dom
以上爲博主原創,博客惟一地址:https://www.cnblogs.com/pfdltutu/p/10557754.html