{"id":242,"title":"linux\u4e0b\u7528composer\u5b89\u88c5thinkphp5","good":0,"bad":0,"hit":1812,"created_at":"2016-10-26 11:50:54","content":"
1\u3001\u5b89\u88c5composer(\u5982\u679c\u6ca1\u6709\u5b89\u88c5\u8fc7\uff09<\/p>
curl -sS https:\/\/getcomposer.org\/installer | phpmv composer.phar \/usr\/local\/bin\/composer<\/p>
<\/p>
\u8981\u68c0\u67e5 Composer \u662f\u5426\u6b63\u5e38\u5de5\u4f5c\uff0c\u53ea\u9700\u8981\u901a\u8fc7 php \u6765\u6267\u884c PHAR\uff1a<\/p>
php composer.phar
<\/p>
<\/p>
\u6587\u6863\uff1a<\/p>
http:\/\/www.kancloud.cn\/manual\/thinkphp5\/118006<\/a><\/p> http:\/\/www.kancloud.cn\/thinkphp\/composer\/35669<\/a> 2\u3001\u7531\u4e8e\u8bbf\u95ee\u56fd\u5916\u9879\u76ee\u6bd4\u8f83\u6162\uff0c\u4fee\u6539composer\u955c\u50cf\u4e3a\u56fd\u5185<\/p> composer config -g repo.packagist composer https:\/\/packagist.phpcomposer.com 3\u3001\u786e\u4fdd\u5b89\u88c5\u6210\u529f\u540e\u5207\u6362\u5230web\u670d\u52a1\u5668\u5b58\u653e\u7ad9\u70b9\u7684\u76ee\u5f55\uff0c\u6211\u8fd9\u91cc\u662f\/www\/wwwroot<\/p> 4\u3001\u5b89\u88c5thinkphp5<\/p> composer create-project topthink\/think tp5(\u8fd9\u4e2a\u662f\u4f60\u7ad9\u70b9\u7684\u76ee\u5f55\u6587\u4ef6\u540d\u79f0\uff0c\u6211\u8fd9\u91cc\u7528\u7684\u662fwww.tp5.vm)<\/a> \u7b49\u5f85\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u914d\u7f6e\u597dapache\u6216\u8005nginx,\u7136\u540e\u4fee\u6539host\u5373\u53ef\u8bbf\u95ee<\/p> 5\u3001\u67e5\u770bthinkphp\u7684\u7248\u672c<\/p> [root@localhost thinkphp]# pwd [root@localhost thinkphp]# cat base.php \u4e0b\u9762\u76845.0.2\u5373\u662fthinkphp\u7684\u7248\u672c<\/p> <?php 6\u3001\u914d\u7f6e\u6587\u4ef6<\/p> \u6211\u8fd9\u91cc\u7684\u662f\u5728\uff1a<\/p> website dir:\/www\/wwwroot\/www.tp5.vm \u4fee\u6539\u914d\u7f6e(nginx)\uff1a<\/p> \u7ad9\u70b9\u6839\u76ee\u5f55\u4e3a\/www\/wwwroot\/www.tp5.vm\/public,\u4e0b\u9762\u7b2c\u4e8c\u4e2a\u52a0\u7c97\u7684\u662f\u5f00\u542frewrite<\/p> [root@localhost vhost]# cat www.tp5.vm.conf 7\u3001\u91cd\u542fnginx\uff0c\u8bbf\u95ee\u7ad9\u70b9\u57df\u540d\u6216ip\u5373\u53ef
<\/p>
<\/p>
\u6587\u6863\uff1ahttp:\/\/pkg.phpcomposer.com\/<\/a>
<\/p>
<\/p>
<\/p>
<\/p>
<\/p>
\/www\/wwwroot\/www.tp5.vm\/thinkphp<\/a>
<\/p>
<\/p>
<\/p>
\/\/ +----------------------------------------------------------------------
\/\/ | ThinkPHP [ WE CAN DO IT JUST THINK ]
\/\/ +----------------------------------------------------------------------
\/\/ | Copyright (c) 2006~2016 http:\/\/thinkphp.cn All rights reserved.
\/\/ +----------------------------------------------------------------------
\/\/ | Licensed ( http:\/\/www.apache.org\/licenses\/LICENSE-2.0 )
\/\/ +----------------------------------------------------------------------
\/\/ | Author: liu21st <liu21st@gmail.com>
\/\/ +----------------------------------------------------------------------
define('THINK_VERSION', '5.0.2');<\/strong>
<\/p>
<\/p>
----------------------------------------
conf file:\/www\/lanmps\/nginx\/conf\/vhost\/www.tp5.vm.conf
----------------------------------------
access_log:\/www\/wwwLogs\/www.tp5.vm.log<\/a>
<\/p>
<\/p>
<\/p>
server
{
listen 80;
server_name www.tp5.vm ;
root \/www\/wwwroot\/www.tp5.vm\/public;<\/strong>
location \/ {
index index.html index.htm index.php default.html default.htm default.php;
if (!-e $request_filename) {
rewrite ^(.*)$ \/index.php?s=$1 last;
break;
}<\/strong>
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*.(js|css)?$ {
expires 12h;
}
location ~ .php$ {
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:\/tmp\/php-cgi.sock;
fastcgi_pass bakend;
fastcgi_index index.php;
include fastcgi.conf;
}
include \/www\/wwwroot\/www.tp5.vm\/lanmps-*.conf;
#log_format www.tp5.vm '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $http_x_forwarded_for';
access_log \/www\/wwwLogs\/www.tp5.vm.log access;
}
<\/p>
<\/p>
<\/p>"}