最近幾天一直鬱悶dfgallery2.0的配置,原打算用作圖片展示程序,1.0用過沒問題,放在opencms上運行很給力。由於圖片展示電腦很多情況下是單機運行,考慮採用獨立平臺的2.0.但是一直沒配置成功。
今天大神來了,一切都改變了。原來老外的程序也有bug(畢竟BUG這個詞是他們發明的),現在把問題表述一下,並且給使用dfgallery2.0的網友提供方便。
1、程序配置成功後不能放在httpd的根目錄,需要配置虛擬目錄或者放到子目錄裏邊。然後修改.htaccess
原來配置:
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>
Options -Indexes
Options +FollowSymLinks
ErrorDocument 404 /index.php
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
修改配置:
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>
Options -Indexes
Options +FollowSymLinks
ErrorDocument 404 /index.php
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /gallery
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
增加配置:RewriteBase /gallery #重寫到子目錄
2、程序默認不支持中文目錄和中文文件名
經過大神檢查後發現程序編碼爲utf-8,但是新建數據庫的編碼居然爲歐洲編碼(¥#%……%¥)
通過這個腳本新建後,問題解決
DROP TABLE IF EXISTS `content`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `content` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
`pid` int(10) unsigned DEFAULT NULL,
`type` varchar(32) NOT NULL,
`title` varchar(128) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK__pid_id` (`pid`),
KEY `FK__uid_uid` (`uid`),
CONSTRAINT `FK__pid_id` FOREIGN KEY (`pid`) REFERENCES `content` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK__uid_uid` FOREIGN KEY (`uid`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `content`
--
LOCK TABLES `content` WRITE;
/*!40000 ALTER TABLE `content` DISABLE KEYS */;
INSERT INTO `content` VALUES (1,1,NULL,'gallery','aaaaa'),(2,1,1,'album','aaaaa'),(3,1,1,'album','aaaaa');
/*!40000 ALTER TABLE `content` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `contentprop`
--
DROP TABLE IF EXISTS `contentprop`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contentprop` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cid` int(10) unsigned NOT NULL,
`name` varchar(100) NOT NULL,
`value` longtext,
PRIMARY KEY (`id`),
KEY `FK__cid_id` (`cid`),
CONSTRAINT `FK__cid_id` FOREIGN KEY (`cid`) REFERENCES `content` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `contentprop`
--
LOCK TABLES `contentprop` WRITE;
/*!40000 ALTER TABLE `contentprop` DISABLE KEYS */;
INSERT INTO `contentprop` VALUES (1,1,'theme','standard'),(2,1,'skin','standard.png'),(3,2,'album_type','flickr'),(4,3,'album_type','custom');
/*!40000 ALTER TABLE `contentprop` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `systemprop`
--
DROP TABLE IF EXISTS `systemprop`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `systemprop` (
`name` varchar(100) NOT NULL,
`value` longtext,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `systemprop`
--
LOCK TABLES `systemprop` WRITE;
/*!40000 ALTER TABLE `systemprop` DISABLE KEYS */;
INSERT INTO `systemprop` VALUES ('flickr_api_key','dc123ae6ab78886c452b7ad44ec171c6');
/*!40000 ALTER TABLE `systemprop` ENABLE KEYS */;
UNLOCK TABLES;