Ò»´ÎNginx+PHP+MysqlµÄ²¢·¢²âÊÔ¾Àú
Ò»´ÎNginx+PHP+MysqlµÄ²¢·¢²âÊÔ¾Àú
Ò»¡¢Ó²¼þ»·¾³
CPU:4ºËIntel(R) Xeon(R) CPU E5504 @ 2.00GHz
6GÄڴ棬120GÓ²ÅÌ
¶þ¡¢Èí¼þ»·¾³
Linux centos12 2.6.18-164.6.1.el5 #1 SMP x86_64 GNU/Linux
nginx-0.7.61.tar.gz
mysql-5.1.35.tar.gz
php-5.2.10.tar.gz
memcache-2.2.5.tgz
eaccelerator-0.9.5.3.tar.bz2
ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
Èý¡¢Ïà¹ØÈí¼þÅäÖÃ
1¡¢NginxÅäÖÃÎļþ
user www www;
#worker_processes 1;
#ÒòΪÎÒÊÇ4ºËcpuËùÒÔÉèÖÃΪ4
worker_processes 4;
error_log /web/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include mime.types;
default_type application/octet-stream;
#charse gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 64k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
#Ôö¼Ó³¬Ê±£¬ÒÔ±ÜÃâ502´íÎó
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
server
{
Ïà¹ØÎĵµ£º
¶¨ÒåÓαê
DECLARE cur_Ãû³Æ CURSOR
FOR
SELECT ×Ö¶Î1,×Ö¶Î2,...×Ö¶În from ±í where ×Ö¶Î1=±äÁ¿;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET ±äÁ¿1=null,±äÁ¿2=null;
OPEN cur_Ãû³Æ;
FETCH cur_Ãû³Æ INTO ±äÁ¿1,±äÁ¿2...;
WHILE ( ±äÁ¿1 IS NOT NULL) DO
&nbs ......
php ÖÐÉú³ÉËæ»ú×Ö·û´®µÄ·½·¨
2009-10-20 13:56
ÔÚһЩÌØÊâÓ¦ÓÃÖУ¬ÐèÒªÉú³ÉËæ»ú×Ö·û´®£¬±ÈÈçÉú³ÉϵͳËæ»úÃÜÂë»òÕßÊǵǽÑéÖ¤ÂëµÈ£¬±¾ÎĽéÉܵĺ¯ÊýÄܹ»·µ»ØÖ¸¶¨³¤¶ÈµÄËæ»ú×Ö·û´®£¬Ä¬ÈÏ°üº¬´óСд×ÖĸºÍÊý×Ö£¬Äã¿ÉÒÔºÜÈÝÒ×µÄÐÞ¸ÄÒÔ±ã·ûºÏ×Ô¼ºµÄÐèÒª¡£
<?php
// ˵Ã÷£ºphp ÖÐÉú³ÉËæ»ú×Ö·û´®µÄ·½·¨
// ÕûÀí£ºhttp://ww ......
Ò»¡¢apache Ô´Âë°²×°
./configure --prefix=/usr/local/apache --enable-so
make
make install
×¢£º°²×°ºóÈç¹û¸Ä±äapacheÆðʼĿ¼(¹¤×÷Ŀ¼)£¬¿ÉÄÜ»á³öÏÖ403´íÎ󣬴ËʱÐÞ¸Ähttpd.confÖеÄUserºÍGroupΪÄã¸Ä±äºó
µÄÆðʼĿ¼ËùÊôµÄÓû§ºÍ×é¼´¿É£¡
ÈçrootÓû§° ......
javaÖÐʱ¼ä´ÁºÍʱ¼ä×Ö·û´®Ö®¼äµÄת»»
»ñÈ¡µ±Ç°µÄunixʱ¼ä´Á
new Date().getTime()
System.currentTimeMillis()
·µ»ØµÄÊǺÁÃëÊý£¬Òª×ª»»long t = System.currentTimeMillis()/1000;
»ñÈ¡µ±Ç°ÄêÔÂÈÕÒÔ¼°Ê±·ÖÃë
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR)) c.get(Calendar.YEAR)) c.get(C ......
¡¡ÔÚPHP¿ª·¢ÖжԱÈÆðCookie£¬session ÊÇ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ»á»°£¬Ïà¶Ô°²È«£¬²¢ÇÒ²»Ïñ Cookie ÄÇÑùÓд洢³¤¶ÈÏÞÖÆ£¬±¾Îļòµ¥½éÉÜ session µÄʹÓá£
¡¡¡¡ÓÉÓÚ Session ÊÇÒÔÎı¾ÎļþÐÎʽ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ£¬ËùÒÔ²»Å¿ͻ§¶ËÐÞ¸Ä Session ÄÚÈÝ¡£Êµ¼ÊÉÏÔÚ·þÎñÆ÷¶ËµÄ Session Îļþ£¬PHP ×Ô¶¯ÐÞ¸Ä session ÎļþµÄȨÏÞ£¬Ö»±£Áô ......