看到ThinkPHP发布了3.1.3版本,下载了一个创建项目玩玩。中间还遇到些小问题,记录一下。
*更新记录:
2015-12-28:修改nginx配置的错误
1.下载解压缩TP
unzip ThinkPHP3.1.3_Full.zip -d /www/lib/
2.创建项目文件
cd /www/cms/tp
vim index.php
1 2 3
| <?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
1 2 3 4 5 6 7
| <?php return array( 'URL_HTML_SUFFIX' => '', 'URL_CASE_INSENSITIVE' => 1, ); ?>
|
至此大功告成
附本人nginx host配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| 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_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; } }
|