看到ThinkPHP发布了3.1.3版本,下载了一个创建项目玩玩。中间还遇到些小问题,记录一下。
1.下载解压缩TP
unzip ThinkPHP3.1.3_Full.zip -d /www/lib/
2.创建项目文件
cd /www/cms/tp
vim index.php
<?php define('APP_DEBUG', 1); require '../../lib/ThinkPHP/ThinkPHP.php';
3.修改权限
chmod 775 . -R
4.浏览器访问,基本上会出现如下错误
无法加载模块:index.php
错误位置
FILE: /data/www/lib/ThinkPHP/Common/functions.php LINE: 112
5.编辑配置文件
vim Conf/config.php
<?php return array( //'配置项'=>'配置值' 'URL_HTML_SUFFIX' => '', 'URL_CASE_INSENSITIVE' => 1, ); ?>
至此大功告成
附本人nginx host配置
# tp.cms.com server { listen 80; root /www/cms/tp; index index.html index.htm index.php index-dev.php; server_name .tp.cms.com; location ~* \.php { fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/tmp/nginx_sockets_php5-fpm.sock; fastcgi_index index.php; include fastcgi.conf; set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 break; } }
更新记录:
2015-12-28:修改nginx配置的错误