php / 未分类 · 2013年12月12日

thinkphp配置

本人会点皮毛的php 如果想搞个东西 于是想到php框架 于是有了如下的文章
第一 安装lnmp 环境 因为本人PC is ubuntu so

其实os eg centos 请见 linuxchina.net/lnmp
##开启nginx 支持 php-fpm
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
#root /home/evan/thinkphp/;
index index.html index.htm;
#index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

vi /usr/share/nginx/www/phpinfo.php
第二 到http://www.thinkphp.cn/
下载包并放到 /usr/share/nginx/www/
cd /usr/share/nginx/www/; mkdir app
chmod -R 777 /usr/share/nginx/www/

root@evan-laptop:/usr/share/nginx/www# vi app/index.php

这样就可以看到thinkphp welcome界面了
http://127.0.0.1/app/index.php
vim /usr/share/nginx/www/app/index.php
#add

参考
http://www.thinkphp.cn/info/60.html
thinkphp 完全开发手册
http://doc.thinkphp.cn/manual/basic_concept.html
http://www.thinkphp.cn/topic/190.html