错误提示:
/usr/bin/ld: /usr/local/lib/libjpeg.a(jcapimin.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
进入Jpeg目录
CFLAGS=”-O3 -fPIC” ./configure
make
make install-lib
编译前需指定为64位编译模式,否则会出现以下错误:
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32against `a local symbol’ can not be used when making a shared object;recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
解决办法 : 重新安装 zlib-1.2.3.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
make
make install
nfig.so -L/usr/lib64 /usr/local/freetype/lib/libfreetype.so -lpng -lz -lm -Wl,–rpath -Wl,/usr/local/freetype/lib -Wl,-soname -Wl,libgd.so.2 -o .libs/libgd.so.2.0.0
/usr/bin/ld: /usr/local/lib/libpng.a(png.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpng.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
重新安装libpng;删除解压文件,重新解压
cp scripts/makefile.linux makefile
vi Makefile
找到 CFLAGS=后加上-fPIC
make test
make install
再重新安接gd;
vi Makefile
找到 CFLAGS=后加上-fPIC
A10、安装 libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure –prefix=/usr/local/libmcrypt
make
make install
四、安装mysql
1.mysql安装
http://dev.mysql.com/doc/refman/5.1/en/index.html
http://dev.mysql.com/doc/refman/5.1/en/installing-source.html
/usr/sbin/groupadd website # 管理组
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql -d /dev/null -s /sbin/nologin
tar zxvf mysql-5.1.26-rc.tar.gz
cd mysql-5.1.26-rc/
CFLAGS=”-O3″ CXX=gcc CXXFLAGS=”-O3 -felide-constructors -fno-exceptions -fno-rtti” ./configure –prefix=/opt/mysql –localstatedir=/opt/mysql/var –sysconfdir=/opt/mysql –without-debug –with-unix-socket-path=/opt/mysql/mysql.sock –with-big-tables –with-charset=gbk –with-collation=gbk_chinese_ci –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –with-extra-charsets=gbk,gb2312,utf8 –with-pthread –enable-thread-safe-client –with-innodb
#–with-innodb时,mysql的data存放于/opt/mysql/var 下,无些参数时为/opt/mysql/data下
默认为/var/lib/mysql (在/etc/my.cnf中)
错误:
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
解决:
# yum -y install ncurses-devel
make
make install
#512M内存和web共用
cp support-files/my-medium.cnf /opt/mysql/my.cnf
#2G内存和web共用
#cp support-files/my-large.cnf /opt/mysql/my.cnf
#删除默认的my.cnf
rm /etc/my.cnf
/opt/mysql/bin/mysql_install_db –defaults-file=/opt/mysql/my.cnf –basedir=/opt/mysql –datadir=/opt/mysql/var –user=mysql –pid-file=/opt/mysql/var/mysql.pid –skip-locking –socket=/opt/mysql/mysql.sock
chmod +w /opt/mysql
chown -R mysql:mysql /opt/mysql
cd ..
chgrp website /opt/mysql/my.cnf
chmod 0664 /opt/mysql/my.cnf
2.自动运行mysql
http://dev.mysql.com/doc/refman/5.1/en/automatic-start.html
cp support-files/mysql.server /opt/mysql/bin/
chmod 755 /opt/mysql/bin/mysql.server
#自动启动
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig –add mysql
#某些linux上
#chkconfig –level 345 mysql on
#开启服务
/etc/init.d/mysql start
#关闭服务
#/etc/init.d/mysql stop
3.手动开启/关闭服务
/bin/sh /opt/mysql/bin/mysqld_safe –user=mysql &
/opt/mysql/bin/mysqladmin -uroot -p shutdown
Enter password:
4.mysql修改密码
#123456为密码
/opt/mysql/bin/mysqladmin -uroot password 123456
#测试密码
/opt/mysql/bin/mysql -uroot -p
Enter password:
5.编辑my.cnf
vi /opt/mysql/my.cnf
关闭log_bin
将log-bin=mysql-bin注释掉,需要热备份或主从服务器的可以保留,开启后会占很多空间
开启innodb
将innodb开头的注释去掉,除了innodb_log_arch_dir参数,开启它将无法启动msyql
修改完成后重启mysql服务
五、安装memcached
官方网站
http://www.monkey.org/~provos/libevent/
http://www.danga.com/memcached/download.bml
1.下载
wget http://www.monkey.org/~provos/libevent-1.4.5-stable.tar.gz
wget http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
2.安装libevent
# tar zxvf libevent-1.4.5-stable.tar.gz
# cd libevent-1.4.5
# ./configure –prefix=/usr
# make
# make install
3.安装memcached
tar zxvf memcached-1.2.5.tar.gz
cd memcached-1.2.5
./configure –prefix=/opt/memcached –with-libevent=/usr
make
make install
4.启动Memcache的服务器端
# /opt/memcached/bin/memcached -d -m 100 -u root -l 127.0.0.1-p 12000 -c 256 -P /tmp/memcached.pid
/opt/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
==========================
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
#cp /usr/lib/libevent* /usr/lib64/ -R
==========================
echo /usr/local/libevent/lib >> /etc/ld.so.conf
ldconfig
-d选项是启动一个守护进程,
-m是分配给Memcache使用的内存数量,单位是MB,我这里是100MB,
-u是运行Memcache的用户,我这里是root,
-l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址192.168.54.96,
-p是设置Memcache监听的端口,我这里设置了12000,最好是1024以上的端口,
-c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,
-P是设置保存Memcache的pid文件,我这里是保存在 /tmp/memcached.pid,
5.如果要结束Memcache进程,执行:
# kill `cat /tmp/memcached.pid`
也可以启动多个守护进程,不过端口不能重复。
5.图形介面监控memcached
http://www.ooso.net/index.php/archives/462
六。安装php
1.php 补丁安装
tar zxvf php-5.2.6.tar.gz
gzip -cd php-5.2.6-fpm-0.5.8.diff.gz | patch -d php-5.2.6 -p1
2.php安装
cd php-5.2.6
./configure –prefix=/opt/php –with-config-file-path=/opt/php/etc –with-mysql=/opt/mysql –with-mysqli=/opt/mysql/bin/mysql_config –with-iconv-dir=/usr/local/libiconv –with-freetype-dir=/usr/local/freetype/ –with-jpeg-dir=/usr/local/jpeg6/ –with-png-dir –with-zlib=/usr/local/zlib/ –with-libxml-dir=/usr/local/libxml/ –enable-xml –enable-zend-multibyte –disable-debug –disable-ipv6 –disable-rpath –enable-discard-path –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –with-mcrypt=/usr/local/libmcrypt/ –with-gd –enable-gd-native-ttf
错误:
checking for xml2-config path…
configure: error: xml2-config not found.
解决:
编译参数最后加上
–with-xml-config=/usr/local/libxml/bin/xml2-config
错误:
configure: error: Please reinstall the libcurl distribution –
easy.h should be in /include/curl/
解决:
yum install curl-devel
sed -i ‘s#-lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt#& -liconv#’ Makefile
make
make install
cp php.ini-dist /opt/php/etc/php.ini
chgrp website /opt/php/etc/php.ini
chmod 0664 /opt/php/etc/php.ini
chgrp website /opt/php/etc/php-fpm.conf
chmod 0664 /opt/php/etc/php-fpm.conf
cd ../
3.编译安装PHP5扩展模块
tar zxvf memcache-2.2.3.tgz
cd memcache-2.2.3/
/opt/php/bin/phpize
错误:
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
解决:
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz
# tar -zvxf autoconf-2.61.tar.gz
# cd autoconf-2.61/
# ./configure
# make
# make install
记得要用2.61 的autoconf-2.62会有错误,郁闷死了
Zend Extension Api No: 220060519
configure.in:77: warning: AC_CACHE_VAL(lt_prog_compiler_static_works, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from…
./configure –with-php-config=/opt/php/bin/php-config
make
make install
cd ../
tar zxvf xcache-1.2.2.tar.gz
cd xcache-1.2.2/
/opt/php/bin/phpize
./configure –with-php-config=/opt/php/bin/php-config –enable-xcache –enable-xcache-coverager –enable-inline-optimization –disable-debug
make
make install
cd ../
4.修改php.ini文件
A
查找/opt/php/etc/php.ini中的extension_dir = “./”
修改为extension_dir = “/opt/php/lib/php/extensions/no-debug-non-zts-20060613/”
并在此行后增加以下几行,然后保存:
extension = “memcache.so”
B
php.ini中
cgi.fix_pathinfo=1; 这样php-cgi方能正常使用SCRIPT_FILENAME这个变量,默认就是1
C
在php.ini尾部增加
[xcache-common]
zend_extension = /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
[xcache.admin]
xcache.admin.user = “xcache”
; xcache.admin.pass = md5($yourpasswd)
;如何生成md5密码: echo -n “password”| md5sum
xcache.admin.pass = “0563ff87afd961147cc3b89fec551a87” #password is c1gstudio
[xcache]
xcache.cacher = On
xcache.shm_scheme = “mmap”
xcache.size = 32M
; cpu number (cat /proc/cpuinfo |grep -c processor)
xcache.count = 2
xcache.slots = 8k
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 2M
; cpu number (cat /proc/cpuinfo |grep -c processor)
xcache.var_count = 2
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.readonly_protection = Off
xcache.mmap_path = “/dev/zero”
D
让session使用memcached
session.save_handler = memcache
session.save_path = “tcp://127.0.0.1:12000”
5.创建用户组
/usr/sbin/groupadd www -g 48
/usr/sbin/useradd -g website www -d /dev/null -s /sbin/nologin
mkdir -p /opt/htdocs/www/nginx
chmod -R 0775 /opt/htdocs/
chown -R www:website /opt/htdocs/
6.创建php-fpm配置文件
(php-fpm是为PHP打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi):
在/opt/php/etc/目录中创建php-fpm.conf文件:
rm -f /opt/php/etc/php-fpm.conf
vi /opt/php/etc/php-fpm.conf
All relative paths in this config are relative to php’s install prefix
Pid file
/opt/php/logs/php-fpm.pid
Error log file
/opt/php/logs/php-fpm.log
Log level
notice
When this amount of php processes exited with SIGSEGV or SIGBUS …
10
… in a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator’s shared memory.
1m
Time limit on waiting child’s reaction on signals from master
5s
Set to ‘no’ to debug fpm
yes
Name of pool. Used in logs and stats.
default
Address to accept fastcgi requests on.
Valid syntax is ‘ip.ad.re.ss:port’ or just ‘port’ or ‘/path/to/unix/socket’
127.0.0.1:9000
Set listen(2) backlog
-1
Set permissions for unix socket, if one used.
In Linux read/write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
0666
Additional php.ini defines, specific to this pool of workers.
/usr/sbin/sendmail -t -i
0
Unix user of processes
www
Unix group of processes
website
Process manager settings
Sets style of controling worker process count.
Valid values are ‘static’ and ‘apache-like’
static
Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
20
Settings group for ‘apache-like’ pm style
Sets the number of server processes created on startup.
Used only when ‘apache-like’ pm_style is selected
20
Sets the desired minimum number of idle server processes.
Used only when ‘apache-like’ pm_style is selected
5
Sets the desired maximum number of idle server processes.
Used only when ‘apache-like’ pm_style is selected
250
Time limit on waiting execution of single request
Should be used when ‘max_execution_time’ ini option does not terminate execution for some reason
31s
Set open file desc rlimit
51200
Set max core size rlimit
0
Chroot to this directory at the start
Chdir to this directory at the start
Redirect workers’ stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI specs
yes
How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
51200
Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only with AF_INET listening socket.
127.0.0.1
Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
$HOSTNAME
/usr/local/bin:/usr/bin:/bin
/tmp
/tmp
/tmp
$OSTYPE
$MACHTYPE
2
和原始配置文件的差别
用户组->www
max_children=64
MaxApareServers=250
rlimit_files=51200
max_requests=51200
去掉注释
7.优化文件句柄并开启php
ulimit -SHn 51200
/opt/php/sbin/php-fpm start
#/opt/php/sbin/php-fpm还有其他参数,包括:start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件使用reload。
七、安装Nginx
1.安装Nginx所需的pcre库
tar zxvf pcre-7.7.tar.gz
cd pcre-7.7/
./configure –enable-utf8 –enable-unicode-properties
make && make install
cd ../
2.安装Nginx
tar zxvf nginx-0.6.32.tar.gz
cd nginx-0.6.32/
A
关闭debug模式来减少nginx大小
http://bianbian.org/technology/271.html
du /opt/nginx/sbin/nginx
#未做优化时的大小
1712 /opt/nginx/sbin/nginx
#优化后的大小
404 /opt/nginx/sbin/nginx
vi auto/cc/gcc
# 最后几行sheft+g
#注释这行
#CFLAGS=”$CFLAGS -g”
B
伪装header
vi src/core/nginx.h
#define NGINX_VERSION “1.0”
#define NGINX_VER “C1GWS/” NGINX_VERSION
C
编译
./configure –user=www –group=website –prefix=/opt/nginx –with-http_stub_status_module –with-http_ssl_module
make
make install
cd ../
3.修改权限
chown -R www:website /opt/nginx/logs/
chmod -R 0775 /opt/nginx/logs/
chown -R www:website /opt/nginx/conf/
chmod -R 0775 /opt/nginx/conf/
4.创建Nginx配置文件
rm -f /opt/nginx/conf/nginx.conf
vi /opt/nginx/conf/nginx.conf
user www website;
worker_processes 4; #cpu*2
error_log /opt/nginx/logs/nginx_error.log crit;
pid /dev/shm/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;
log_format access ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” $http_x_forwarded_for’;
charset utf-8;
server_names_hash_bucket_size 128;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_intercept_errors on; # 解决 no input file specified
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_temp_path /dev/shm;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css text/html application/xml;
server
{
listen 80;
server_name devwww.c1gstudio.com;
index index.html index.htm index.php;
root /opt/htdocs/www;
location ~ .*\.php?$
{
include fcgi.conf;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
access_log /opt/nginx/logs/access.log access;
}
server
{
listen 80;
server_name devstatus.c1gstudio.com;
index index.html index.htm index.php;
root /opt/htdocs/status;
error_page 404 /404.html;
#error_page 500 502 503 504 /50x.html;
location ~ .*\.php?$
{
include fcgi.conf;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
location /nginx {
stub_status on;
access_log off;
auth_basic “NginxStatus”;
auth_basic_user_file htpasswd;
#用apache的htpasswd生成访问密码
#/opt/apache2/bin/htpasswd -c /opt/nginx/conf/htpasswd c1gstduio admin
}
# alias
#localtion /alias/ {
#alias /spool/w3/images/;
#}
#防盗链
location ~* ^.+\.(jpg|jpeg|gif|png|swf|rar|zip)$ {
valid_referers none blocked *.yingjiesheng.com *.yingjiesheng.net localhost;
if ($invalid_referer) {
rewrite ^/ http://www.c1gstudio.com/logo.gif;
return 403;
}
}
# add expires header for static content
location ~* ^.+\.(jpg|jpeg|gif|png|css|js|ico|html)$ {
access_log off;
root /opt/htdocs/www;
expires 2h;
break;
}
#禁止访问
location ~/\.ht {
deny all;
}
location /(themes|templates_c)/ {
deny all;
}
access_log /opt/nginx/logs/status.log access;
}
}
5.nginx的日志滚动
mkdir 0775 /opt/shell
chgrp website /opt/shell
vi /opt/shell/nginx_log.sh
#!/bin/sh
log_dir=/opt/nginx/logs
yesterday=`date +%Y%m%d`
lastday=`date +%Y%m%d -d ‘-1 month’`
/bin/rm ${log_dir}/access.${lastday}.log
/bin/rm ${log_dir}/nginx_error.${lastday}.log
/bin/mv ${log_dir}/access.log ${log_dir}/access.${yesterday}.log
/bin/mv ${log_dir}/nginx_error.log ${log_dir}/nginx_error.${yesterday}.log
kill -USR1 `cat /opt/nginx/nginx.pid`
/bin/gzip ${log_dir}/access.${yesterday}.log &
/bin/gzip ${log_dir}/nginx_error.${yesterday}.log &
在crontab里每日23:59时
59 23 * * * /bin/sh /opt/shell/nginx_log.sh > /dev/null 2>&;1
http://www.bullog.cn/blogs/shunz/archives/157311.aspx
6.让nginx支持FastCGI
http://wiki.codemongers.com/NginxSimpleCGI
http://wiki.codemongers.com/NginxSimpleCGI?action=recall&rev=10
7.cpan安装
A
#perl -MCPAN -e ‘install FCGI’
一路回车
或使用原码安装
B
#wget http://www.cpan.org/modules/by-module/FCGI/FCGI-0.67.tar.gz
#tar zxvf FCGI-0.67.tar.gz
#cd FCGI-0.67
#perl Makefile.PL
#make
#make install
#mkdir -p /var/run/nginx/
如果makefile时遇到错误
perl Makefile.PL INSTALL_BASE=~
Can’t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed–compilation aborted at Makefile.PL line 3.
安装perl-ExtUtils-MakeMaker
yum install perl-ExtUtils-MakeMaker
将链接网页中的perl代码保存成perl-fcgi.pl并运行
chmod o+x /opt/shell/perl-fcgi.pl
perl /opt/shell/perl-fcgi.pl
修改nginx配置文件
检查nginx配置文件/重新载入/关闭nginx
/opt/nginx/sbin/nginx -t
kill -HUP 进程号 # 重载配置文件
kill -15 进程号 # 关闭
8.pear升级
使用新装的pear代替系统的pear
#which pear
/usr/bin/pear
#pear config-show
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir /usr/bin
PEAR documentation directory doc_dir /usr/share/pear/doc
PHP extension directory ext_dir /usr/lib/php4
PEAR directory php_dir /usr/share/pear
PEAR Installer cache directory cache_dir /tmp/pear/cache
PEAR data directory data_dir /usr/share/pear/data
PHP CLI/CGI binary php_bin /usr/bin/php
PEAR test directory test_dir /usr/share/pear/test
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin /usr/bin/gpg
Signature Key Directory sig_keydir /etc/pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename /root/.pearrc
System Configuration File Filename /etc/pear.conf
#/opt/php/bin/pear config-show
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir /opt/php/bin
PEAR documentation directory doc_dir /opt/php/lib/php/doc
PHP extension directory ext_dir /opt/php/lib/php/extensions/no-debug-non-zts-20060613
PEAR directory php_dir /opt/php/lib/php
PEAR Installer cache directory cache_dir /tmp/pear/cache
PEAR data directory data_dir /opt/php/lib/php/data
PHP CLI/CGI binary php_bin /opt/php/bin/php
PEAR test directory test_dir /opt/php/lib/php/test
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
cfg_dir
download_dir
php_ini
temp_dir
www_dir
PEAR password (for password
maintainers)
Signature Handling Program sig_bin /usr/bin/gpg
Signature Key Directory sig_keydir /opt/php/etc/pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename /root/.pearrc
System Configuration File Filename /opt/php/etc/pear.conf
#mv /usr/bin/pear /usr/bin/pear.del
#ln -s /opt/php/bin/pear /usr/bin/pear
#pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
PEAR 1.7.1 stable
Structures_Graph 1.0.2 stable
#pear upgrade pear
#pear install Benchmark Cache_Lite DB HTTP Mail Mail_Mime Net_SMTP Net_Socket Pager XML_Parser XML_RPC
#pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.2 stable
Benchmark 1.2.7 stable
Cache_Lite 1.7.4 stable
Console_Getopt 1.2.3 stable
DB 1.7.13 stable
Mail 1.1.14 stable
Mail_Mime 1.5.2 stable
Mail_mimeDecode 1.5.0 stable
Net_SMTP 1.3.1 stable
Net_Socket 1.0.9 stable
PEAR 1.7.2 stable
Pager 2.4.7 stable
Structures_Graph 1.0.2 stable
XML_Parser 1.3.0 stable
XML_RPC 1.5.1 stable
八、awstats安装
linux awstats 安装
清除日志记录可以删除conf中DirData=”/var/lib/awstats” 下的文件
分析
perl /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=sina -update
查看,在ie中输入
http://localhost/awstats/awstats.pl?config=sina
自动运行,在crontab中加入
10 8 * * * (cd /opt/awstats/wwwroot/cgi-bin/; ./awstats.pl -update -config=sina )
九、apache与nginx+php cgi性能比较
http://www.guogoul.com/2008/07/08/nginx_2/
十、快捷控制脚本
点此下载lemp脚本
/opt/lemp
Usage: /opt/lemp
start Start LEMP (nginx, MySQL, phpfpm, tomcat)
startnginx Start only nginx
startmysql Start only MySQL
starttomcat Start only tomcat
startphpfpm Start only phpfpm
startmemcached Start only memcached
stop Stop LEMP (nginx, MySQL, phpfpm, tomcat)
stopnginx Stop only nginx
stopmysql Stop only MySQL
stoptomcat Stop only tomcat
stopphpfpm Stop only phpfpm
stopmemcached Stop only memcached
reload Reload LEMP (nginx, MySQL, phpfpm )
reloadnginx Reload only nginx
reloadmysql Reload only MySQL
reloadphpfpm Reload only phpfpm
restart Stop and start LEMP
十一、防arp
http://bbs.linuxtone.org/thread-41-1-1.html
参考
http://blog.s135.com/read.php/351.htm
http://31543.blog.51cto.com/21543/83964
===============================================================
update 2008/08/14
A
解决php 404错误为 no input file specified
在nginx.conf中增加
fastcgi_intercept_errors on;
B
优化
#ulimit -SHn 51200
#vi /etc/rc.local
尾部增加
ulimit -SHn 51200
#vi /etc/sysctl.conf
尾部增加
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
#/sbin/sysctl -p
C
PHP FastCGI进程数多少合适?
netstat -anpo | grep “php-cgi” | wc -l
如果实际使用的“FastCGI进程数”接近预设的“FastCGI进程数”,那么,说明“FastCGI进程数”不够用,需要增大。
========================================================
update 2009-8-19
万恶的wp编辑器把文章搞乱了
好文章啊
nes游戏网 http://www.nesnes.cn
我喜欢啊216