分页: 12/28 第一页 上页 7 8 9 10 11 12 13 14 15 16 下页 最后页 [ 显示模式: 摘要 | 列表 ]
Apr 20
[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

RewriteRule ^(.*)/index.html$                $1/index\.php          [I]                      
RewriteRule ^(.*)/category$                  $1/index\.php          [I]
RewriteRule ^(.*)/feed-c([0-9]+).xml$        $1/feed\.php\?cat=$2    [I]
RewriteRule ^(.*)/feed-b([0-9]+).xml$        $1/feed\.php\?brand=$2 [I]
RewriteRule ^(.*)/feed.xml$                  $1/feed\.php           [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$    $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)\.html$                            $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6                          [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$                                $1/category\.php\?id=$2&brand=$3&page=$4&sort=$5&order=$6                                          [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$                                        $1/category\.php\?id=$2&brand=$3&page=$4                                                           [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$                                            $1/category\.php\?id=$2&brand=$3                                                                   [I]
RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$                                 $1/category\.php\?id=$2                              [I]
RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$                                  $1/goods\.php\?id=$2                                 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$                   $1/article_cat\.php\?id=$2&page=$3                   [I]
RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$                            $1/article_cat\.php\?id=$2                           [I]
RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$                                $1/article\.php\?id=$2                               [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html   $1/brand\.php\?id=$2&cat=$3&page=$4&sort=$5&order=$6 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html                $1/brand\.php\?id=$2&cat=$3&page=$4                  [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html                         $1/brand\.php\?id=$2&cat=$3                          [I]
RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html                                   $1/brand\.php\?id=$2                                 [I]
RewriteRule ^(.*)/tag-(.*)\.html                                             $1/search\.php\?keywords=$2                          [I]
RewriteRule ^(.*)/snatch-([0-9]+)\.html$                                     $1/snatch\.php\?id=$2                                [I]
RewriteRule ^(.*)/group_buy-([0-9]+)\.html$                                  $1/group_buy\.php\?act=view&id=$2                    [I]
RewriteRule ^(.*)/auction-([0-9]+)\.html$                                    $1/auction\.php\?act=view&id=$2                      [I]
Apr 18
[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
RewriteBase /
RewriteRule ^(.*)-p-(.*).html(\?)?(.*)? /index\.php\?main_page=product_info&products_id=$2&$4 [L]
RewriteRule ^(.*)-c-(.*).html(\?)?(.*)? /index\.php\?main_page=index&cPath=$2&$4 [L]
RewriteRule ^(.*)-m-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=index&manufacturers_id=$2&$4 [L]
RewriteRule ^(.*)-pi-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=popup_image&pID=$2&$4 [L]
RewriteRule ^(.*)-pr-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=product_reviews&products_id=$2&$4 [L]
RewriteRule ^(.*)-pri-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=product_reviews_info&products_id=$2&$4 [L]
# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=info_manager&pages_id=$2&$4
# For dreamscape''s News & Articles Manager
RewriteRule ^news/?$ index\.php\?main_page=news& [L]
RewriteRule ^news/rss.xml /index\.php\?main_page=news_rss& [L]
RewriteRule ^news/archive/? /index\.php\?main_page=news_archive& [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html(\?)?(.*)? /index\.php\?main_page=news&date=$1-$2-$3&$5 [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html(\?)?(.*)? /index\.php\?main_page=news_archive&date=$1-$2&$4 [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html(\?)?(.*)? /index\.php\?main_page=news_comments&article_id=$2&$4 [L]
RewriteRule ^news/(.*)-a-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=news_article&article_id=$2&$4 [L]
# All other pages
# Don''t rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(\w*).html\?(.*) /index\.php\?main_page=$1&$2 [L]
#RewriteRule ^/(.*).html(\?)? /index\.php\?main_page=$1&$3 [L]
RewriteRule ^/(\w*).html /index\.php\?main_page=$1&$3 [L]
Tags: , ,
Jan 6
memcached的API使用三十二位元的循环冗余校验(CRC-32)计算键值后,将资料分散在不同的机器上。当表格满了以后,接下来新增的资料会以LRU机制替换掉。由于memcached通常只是当作快取系统使用,所以使用memcached的应用程式在写回较慢的系统时(像是后端的数据库)需要额外的程式码更新memcached内的资料。memcached具有多种语言的客户端开发包,包括:Perl/PHP/JAVA/C/Python/Ruby/C#/MySQL/客户端包的下载地址是:http://www.danga.com/memcached/apis.bml

下载和安装
memcache服务端安装
wget http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz

tar zxvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable
./configure --prefix=/usr
make & make install

tar zxvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure --prefix=/usr/local/memcache/ --with-libevent=/usr
make & make install
安装完成,启动
/usr/local/memcache/bin/memcached -d -m 512 -u apache -p 11211 -c 25600
-d 以守护进程方式启动
-m 512 是指分配512M内存
-u apache 是用apache用户启动
-p 11211 使用11211端口
-c 25600 最大的迸发连接数

PHP扩展(也就是客户端),也就是让PHP支持memcache
下载安装
wget http://pecl.php.net/get/memcache-2.2.6.tgz
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6
phpize
./configure --with-php-config=/usr/bin/php-config --with-zlib-dir=/usr/ --enable-memcache
make & make install
完成之后在/etc/php.d里面创建一个memcache.ini里面加入extension=memcache.so
重启apache
service httpd restart

memcache状态web界面接口,复制memcache.php到网站的根目录,如
cp memcache.php /www/
修改用户密码,如下
vi memcache.php
define('ADMIN_USERNAME','test');     // Admin Username
define('ADMIN_PASSWORD','password');    // Admin Password

然后用IE浏览器打开 http://192.168.1.168/memcache.php,即可查看相关状态信息

打开phpinfo检查,如
http://192.168.1.168/phpinfo.php
能看如下图的信息,表示安装成功,也就是你的PHP已经支持memcache了

在你的PHP程序里,就可以使用memcache这个缓存数据库了

PHP测试实例


< ?php
//连接
$mem = new Memcache;
$mem->connect("127.0.0.1", 11211);
//保存数据
$mem->set('key1', 'This is first value', 0, 60);
$val = $mem->get('key1');
echo "Get key1 value: " . $val ."<br />";

//替换数据
$mem->replace('key1', 'This is replace value', 0, 60);
$val = $mem->get('key1');
echo "Get key1 value: " . $val . "<br />";

//保存数组
$arr = array('aaa', 'bbb', 'ccc', 'ddd');
$mem->set('key2', $arr, 0, 60);
$val2 = $mem->get('key2');
echo "Get key2 value: ";
print_r($val2);
echo "<br />";

//删除数据
$mem->delete('key1');
$val = $mem->get('key1');
echo "Get key1 value: " . $val . "<br />";

//清除所有数据
$mem->flush();
$val2 = $mem->get('key2');
echo "Get key2 value: ";
print_r($val2);
echo "<br />";

//关闭连接
$mem->close();
?>
Dec 28
Description: The Error means The connection with the server has been terminated.

If you check out the C:\Windows\system32\LogFiles\HTTPERR\httperr*.log files on the distribution server, you'll likely see either Timer_MinBytesPerSecond errors or Timer_ConnectionIdle errors. These are caused by IIS' default settings, contained within its metabase, which define the minimum traffic flow rate for a connection to be kept alive and the maximum idle time allowed before a connection is dropped. For some reason, SUS servers seem to take their good old time while downloading updates, and these parameters are exceeded and the distribution server drops 'em.

1) From IIS Manager, right click on the Internet Information Server (IIS) Manager root level folder and go to Properties. Check the box to enable direct metabase editing. Click OK.

2) Open the C:\Windows\system32\inetsrv\Me-taBase.xml file in Notepad. Do a search for "MinFileBytesPerSec". Change the setting for MinFileBytesPerSec from 240 to 0. Do another search, this time for "ConnectionTimeout" to be 600. Save changes and exit.

3) Restart the IIS Admin service to effect the changes.
Dec 13
今天公司网站需要PHP的一个JSON扩展,使用PHPINFO查看了一下默认并没有安装,YUM搜索了一下也没有这个JSON的包,看来只能通过手工来安装一个了,安装的步骤很简单。

下载源文件包:
wget http://www.aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2
wget http://pecl.php.net/get/json-1.2.1.tgz
http://pecl.php.net/package/json
然后解压下载的php-json-ext-1.2.0.tar.bz2文件
tar xvjf php-json-ext-1.2.0.tar.bz2
进入目录php-json-ext-1.2.0
cd php-json-ext-1.2.0
初始化PHP环境
phpize
接着编译
./configure
make
make install
编译过程中如无错误,可以进入PHP的扩展目录看下有没有生成json.so文件
cd /usr/lib/php/modules/
ls
查看是不是有 json.so
如果没有那就没有编译成功,然后在/etc/php.d/目录里创建一个json.ini文件
vi /etc/php.d/json.ini
写入:extension=json.so
重启apache服务
/etc/init.d/httpd restart 就可以了,然后phpinfo查看下是否加载了json扩展。
Tags: , ,
分页: 12/28 第一页 上页 7 8 9 10 11 12 13 14 15 16 下页 最后页 [ 显示模式: 摘要 | 列表 ]