May
7
下载Apache for windows
httpd-2.2.17-win32-x86-no_ssl.msi: http://httpd.apache.org/download.cgi
下载PHP
php-5.2.17-Win32-VC6-x86.zip: http://windows.php.net/download/
系统约定:
安装Apache.
解压PHP到Apache安装目录下.
添加系统环境变量:
打开httpd.conf
httpd-2.2.17-win32-x86-no_ssl.msi: http://httpd.apache.org/download.cgi
下载PHP
php-5.2.17-Win32-VC6-x86.zip: http://windows.php.net/download/
系统约定:
Apache安装目录: E:/Apache
php目录: E:/Apache/php
网站根目录: E:/wwwroot
php目录: E:/Apache/php
网站根目录: E:/wwwroot
安装Apache.
解压PHP到Apache安装目录下.
添加系统环境变量:
E:/Apache/php;E:/Apache/php/ext
打开httpd.conf
Apr
13
最近公司服务器由windows+iis转换成了linux+nginx,在程序移植到linux上的时候发现有些地方需要修改一下才正常,本地用的是windows2003,为了保证做的程序在服务器上能正常运行,所以我在本地做了一个nginx+php的环境.
软件版本: nginx -> 0.8.54 php -> 5.2.14
下载地址: http://soft.befen.net/test/nginx.zip
安装方法:
解压nginx.zip到C盘,注意这里一定要C盘,不然无法运行,当然了,如果你懂的话可以修改路径.
环境的启动关闭和重启操作可以运行nginx目录下的Server.bat,我已经做好了批处理.
配置文件在nginx/conf/vhost/目录下,增加网站只要新建一个***.conf就行了.
nginx目录下还有memcached目录,这个是memcached缓存系统,如果需要就打开cmd执行
附上nginx的配置文件:
软件版本: nginx -> 0.8.54 php -> 5.2.14
下载地址: http://soft.befen.net/test/nginx.zip
安装方法:
解压nginx.zip到C盘,注意这里一定要C盘,不然无法运行,当然了,如果你懂的话可以修改路径.
环境的启动关闭和重启操作可以运行nginx目录下的Server.bat,我已经做好了批处理.
配置文件在nginx/conf/vhost/目录下,增加网站只要新建一个***.conf就行了.
nginx目录下还有memcached目录,这个是memcached缓存系统,如果需要就打开cmd执行
C:\nginx\memcached\memcached.exe -d install
C:\nginx\memcached\memcached.exe -d start
C:\nginx\memcached\memcached.exe -d start
附上nginx的配置文件:
Apr
13
使用方法:
GBK字符集下,我做中文伪静态的时候,用非转义url格式网页出现乱码.
我查了查,是因为GET下来的字符串默认是UTF-8,最后就使用了这个函数就解决了.
其实很简单,就是使用了PHP下的mb_convert_encoding函数,我扩展了一下,支持四种字符集转换,所以PHP必须支持mb_convert_encoding函数.
<?php
$str = '这里是需要格式的字符串';
$new_str = phpcharset($str, 'GBK');
echo $new_str;
function phpcharset($data, $to) {
$encode_array = array('ASCII', 'UTF-8', 'GBK', 'GB2312', 'BIG5');
$encoded = mb_detect_encoding($data, $encode_array);
$data = mb_convert_encoding($data, $to, $encoded);
return $data;
}
?>
$str = '这里是需要格式的字符串';
$new_str = phpcharset($str, 'GBK');
echo $new_str;
function phpcharset($data, $to) {
$encode_array = array('ASCII', 'UTF-8', 'GBK', 'GB2312', 'BIG5');
$encoded = mb_detect_encoding($data, $encode_array);
$data = mb_convert_encoding($data, $to, $encoded);
return $data;
}
?>
GBK字符集下,我做中文伪静态的时候,用非转义url格式网页出现乱码.
我查了查,是因为GET下来的字符串默认是UTF-8,最后就使用了这个函数就解决了.
其实很简单,就是使用了PHP下的mb_convert_encoding函数,我扩展了一下,支持四种字符集转换,所以PHP必须支持mb_convert_encoding函数.
Apr
12
Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程(daemon )是用C写的,但是客户端可以用任何语言来编写,并通过memcached协议与守护进程通信。但是它并不提供冗余(例如,复制其hashmap条目);当某个服务器S停止运行或崩溃了,所有存放在S上的键/值对都将丢失。
下面是安装方法:
下面是安装方法:
Apr
12
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/
./configure
make && make install
cd ../
groupadd www
useradd -g www www
mkdir -p /home/wwwroot
chmod +w /home/wwwroot
wget http://www.nginx.org/download/nginx-0.8.54.tar.gz
tar zxvf nginx-0.8.54.tar.gz
cd nginx-0.8.54/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make && make install
cd ../
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/
./configure
make && make install
cd ../
groupadd www
useradd -g www www
mkdir -p /home/wwwroot
chmod +w /home/wwwroot
wget http://www.nginx.org/download/nginx-0.8.54.tar.gz
tar zxvf nginx-0.8.54.tar.gz
cd nginx-0.8.54/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make && make install
cd ../





