码迷,mamicode.com
首页 > 其他好文 > 详细

sNews1.7在wamp上的部署及运行

时间:2020-04-12 16:15:01      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:log   visible   ges   文件夹   publish   原因   默认   search   app   

安装前的准备

  • Apache Server 必须开启 mod_rewrite 模块
  • MySQL 数据库版本在 4.x以上
  • PHP: >= 4.x 并且 <=5.6

1.我使用的是wampsever,需要所有服务正常运行即图标绿色,如下图

技术图片

2.开启mod_rewrite模块(一般在 wamp安装路径\bin\apache\apache版本号\conf\httpd.conf。比如我的是 F:\wamp64\bin\apache\apache2.4.37\conf\httpd.conf)

技术图片

如果有这句话 LoadModule rewrite_module modules/mod_rewrite.so 去掉前面的#,如果没有就加上这句话。

安装步骤

1.设置数据库

如果安装路径下有snews.sql文件(在SQL文件夹里),可以直接把查询放到自己的数据库里执行。如果没有就得自己写一个,如下:

打开mysql的命令行

技术图片

一般情况下,新安装的wamp数据库用户名是root,没有密码,直接回车就可进入

技术图片

CREATE DATABASE snew;    //创建一个数据库,数据库名称可以更改,这里以snew为例
USE DATABASE snew;
CREATE TABLE `articles` (
    `id` int(11) primary key auto_increment,
    `title` varchar(100) default NULL,
    `seftitle` varchar(100) default NULL,
    `text` longtext,
    `date` datetime default NULL,
    `category` int(8) NOT NULL default 0,
    `position` int(6) default NULL,
    `extraid` varchar(8) default NULL,
    `page_extra` varchar(8) default NULL,
    `displaytitle` char(3) NOT NULL default YES,
    `displayinfo` char(3) NOT NULL default YES,
    `commentable` varchar(5) NOT NULL default ‘‘,
    `published` int(3) NOT NULL default 1,
    `description_meta` varchar(255) default NULL,
    `keywords_meta` varchar(255) default NULL,
    `show_on_home` enum(YES,NO) default YES,
    `show_in_subcats` enum(YES,NO) default NO,
    `artorder` smallint(6) NOT NULL default 0,
    `visible` varchar(6) default YES,
    `default_page` varchar(6) default NO
);
技术图片
INSERT INTO `articles` VALUES
(1, Welcome to sNews 1.7, welcome-to-snews-17, 
If youre seeing this article, you have installed sNews 1.7 and are connected to the database.

rnrn
It is strongly suggested that you login right away, the default username and password is "test" and "test", then go to the page "settings". At the bottom of that page youll find "Change Username and Password". Do it and make the password hard to guess.

rnrn
After doing that, feel free to delete this article & start building your site.

rnrn
If you stumble along the way, check the Troubleshooting and FAQ page.  If youre still having trouble search the sNews CMS Forum before posting your question, it may already be answered.  Still lost? Well be there to assist you in any way we can.

rnrn
Thank you for choosing sNews.  We hope you enjoy it as much as we do.

, NOW(), 1, 1, ‘‘, ‘‘, YES, YES, NO, 1, ‘‘, ‘‘, YES, NO, 1, YES, NO);

CREATE TABLE `extras` (
    `id` int(8) primary key auto_increment,
     `name` varchar(40) NOT NULL,
    `seftitle` varchar(100) default NULL,
    `description` varchar(100) NOT NULL
);
    INSERT INTO `extras` VALUES (1, Extra, extra, The default extra);

CREATE TABLE `categories` (
    `id` int(8) primary key auto_increment,
     `name` varchar(100) NOT NULL,
     `seftitle` varchar(100) NOT NULL,
     `description` varchar(255) NOT NULL,
     `published` varchar(4) NOT NULL default YES,
     `catorder` smallint(6) NOT NULL default 0,
     `subcat` int(8) NOT NULL default 0
);
    INSERT INTO `categories` VALUES (1, Uncategorized, uncategorized, ‘‘, YES, 1, 0);

CREATE TABLE `comments` (
     `id` int(11) primary key auto_increment,
     `articleid` int(11) default 0,
     `name` varchar(50),
     `url` varchar(100) NOT NULL,
     `comment` text,
     `time` datetime NOT NULL default 0000-00-00 00:00:00,
     `approved` varchar(5) NOT NULL default True
);

CREATE TABLE `settings` (
     `id` int(8) primary key auto_increment,
     `name` varchar(20) NOT NULL,
     `value` varchar(255) NOT NULL
);
    INSERT INTO `settings` VALUES (1, website_title, sNews 1.7);
    INSERT INTO `settings` VALUES (2, home_sef, home);
    INSERT INTO `settings` VALUES (3, website_description, sNews CMS);
    INSERT INTO `settings` VALUES (4, website_keywords, new, site, snews);
    INSERT INTO `settings` VALUES (5, website_email, info@mydomain.com);
    INSERT INTO `settings` VALUES (6, contact_subject, Contact Form);
    INSERT INTO `settings` VALUES (7, language, EN);
    INSERT INTO `settings` VALUES (8, charset, UTF-8);
    INSERT INTO `settings` VALUES (9, date_format, d.m.Y. H:i);
    INSERT INTO `settings` VALUES (10, article_limit, 3);
    INSERT INTO `settings` VALUES (11, rss_limit, 5);
    INSERT INTO `settings` VALUES (12, display_page, ‘‘);
    INSERT INTO `settings` VALUES (13, display_new_on_home, ‘‘);
    INSERT INTO `settings` VALUES (14, display_pagination, ‘‘);
    INSERT INTO `settings` VALUES (15, num_categories, on);
    INSERT INTO `settings` VALUES (16, show_cat_names, ‘‘);
    INSERT INTO `settings` VALUES (17, approve_comments, ‘‘);
    INSERT INTO `settings` VALUES (18, mail_on_comments, ‘‘);
    INSERT INTO `settings` VALUES (19, comment_repost_timer, 20);
    INSERT INTO `settings` VALUES (20, comments_order, ASC);
    INSERT INTO `settings` VALUES (21, comment_limit, 30);
    INSERT INTO `settings` VALUES (22, enable_comments, NO);
    INSERT INTO `settings` VALUES (23, freeze_comments, NO);
    INSERT INTO `settings` VALUES (24, word_filter_enable, ‘‘);
    INSERT INTO `settings` VALUES (25, word_filter_file, ‘‘);
    INSERT INTO `settings` VALUES (26, word_filter_change, ‘‘);
    INSERT INTO `settings` VALUES (27, username, 098f6bcd4621d373cade4e832627b4f6);
    INSERT INTO `settings` VALUES (28, password, 098f6bcd4621d373cade4e832627b4f6);
    INSERT INTO `settings` VALUES (29, enable_extras, NO);
    INSERT INTO `settings` VALUES (30, last_date, NOW());
    INSERT INTO `settings` VALUES (31, file_extensions, phps,php,txt,inc,htm,html);
    INSERT INTO `settings` VALUES (32, allowed_files, php,htm,html,txt,inc,css,js,swf);
    INSERT INTO `settings` VALUES (33, allowed_images, gif,jpg,jpeg,png);

    -- SPECIAL KEYS

    ALTER TABLE `articles` ADD INDEX ( `show_on_home` );
    ALTER TABLE `comments` ADD INDEX ( `articleid` );
View Code

上述代码创建时,

 `time` datetime NOT NULL default ‘0000-00-00 00:00:00‘,

可能会报错ERROR 1067 (42000): Invalid default value for ‘add_time‘,
CREATE TABLE `comments` (
     `id` int(11) primary key auto_increment,
     `articleid` int(11) default 0,
     `name` varchar(50),
     `url` varchar(100) NOT NULL,
     `comment` text,
     `time` datetime NOT NULL default 0000-00-00 00:00:00,//在这里
     `approved` varchar(5) NOT NULL default True
);

原因是不满足sql_mode中的NO_ZERO_DATE 和 NO_ZERO_IN_DATE。

1. 修改sql_mode,去掉NO_ZERO_IN_DATE,NO_ZERO_DATE

2. 修改表的default值,去掉default。

3.我是直接改成了`time` datetime DEFAULT NULL COMMENT ‘0000-00-00 00:00:00‘,

修改代码后创建表,没有错误。

2.修改设置

编辑 安装路径下的"snews.php" 并且 在此文件中根据自己的需求更改 :

MySQL 本地服务器: 
‘dbhost‘ => ‘localhost‘,

数据库名字: 之前创建的数据库是snew
‘dbname‘ => ‘snew‘,

数据库用户名: 可自行选择,我选择的是超级用户
‘dbuname‘ => ‘root‘,

数据库密码: 初始密码为空,我也没有做任何更改
‘dbpass‘ => ‘‘,

数据库前缀: 必须以下划线结尾 (例如: ‘snews_‘); 
‘prefix‘ => ‘‘

数据库表前缀-如果数据库中的所有sNews表被放置在数据库中,并且需要对其进行唯一命名,以免与数据库中的其他表冲突,则在这些表的名称之前添加一个前缀。可以将前缀添加到SQL脚本中的表名中(如上所述)。以snews_为例,articles表名(及其关联的数据插入字符串)加上前缀后:snews_articles,并且此处的前缀值还将带有一个下划线(例如:‘snews_‘),该名称通过phpmyadmin或类似名称创建的数据库编辑器,通常在托管公司仅提供一个数据库时使用。

  登录时默认的用户名是test,密码是test

   技术图片

 

sNews1.7在wamp上的部署及运行

标签:log   visible   ges   文件夹   publish   原因   默认   search   app   

原文地址:https://www.cnblogs.com/wangqr907/p/12685737.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!