windows下安装apc缓存
[ 2010/09/03 10:51 | by admin ]
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com
windows下安装apc缓存
下载地址:
http://downloads.php.net/pierre/
下载相应版本
解压出php_apc.dll,拷贝入php\ext目录
修改php.ini
增加:
extension=php_apc.dll
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 2048
apc.write_lock = On
apc.gc_ttl = 3600
apc.ttl= 7200
apc.enable_cli=1
apc.enabled = 1
重启iis或apache即可
注意apc与zend有冲突,所以要使用apc就要放弃使用zend
本文来自http://blog.gsywx.com
windows下安装apc缓存
下载地址:
http://downloads.php.net/pierre/
下载相应版本
解压出php_apc.dll,拷贝入php\ext目录
修改php.ini
增加:
extension=php_apc.dll
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 2048
apc.write_lock = On
apc.gc_ttl = 3600
apc.ttl= 7200
apc.enable_cli=1
apc.enabled = 1
重启iis或apache即可
注意apc与zend有冲突,所以要使用apc就要放弃使用zend
linux安装APC缓存的安装
[ 2010/09/03 09:23 | by admin ]
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com
APC的php扩展下载地址:
http://pecl.php.net/package/APC
wget http://pecl.php.net/get/APC-3.1.4.tgz
tar zxvf APC-3.1.4.tgz
cd APC-3.1.4
/web/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/web/php/bin/php-config
make
make install
返回:
Installing shared extensions: /web/php/lib/php/extensions/no-debug-non-zts-20060613/
vi /etc/php
查找extension_dir,在下面加上:
extension=apc.so
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 2048
apc.write_lock = On
apc.gc_ttl = 3600
apc.ttl= 7200
apc.enable_cli=1
相关参数说明:(完整的参数说明请查看INSTALL文件)
apc.enabled = 1
设置0可以禁用APC。主要当APC被静态编译到PHP时,没有其他的方法来禁用它,编制了zend_extension时可以注释掉。默认值为:1
apc.shm_segments = 1
为编译器缓冲区分配的共享内存块数量(建议值为1)。将其设置为1以外的值并没有影响模式的mmap,因为mmap'ed的SHM段没有大小限制。
如果APC耗尽了共享内存,并且已将apc.shm_size指令设为系统允许的最大值,你可以尝试增大此值。默认值为:1
apc.shm_size = 30
每个共享内存块的大小(以MB为单位,建议值为128~256)。
有些系统(包括大多数BSD)默认的共享内存块大小非常小。默认值为:30
apc.num_files_hint = 1000
Web服务器上可能被包含或被请求的不同源文件的大致数量(建议值为1024~4096)。
如果你不能确定,则设为 0 ;此设定主要用于拥有数千个源文件的站点。默认值为:1000
apc.user_entries_hint =4096
同apc.num_files_hint。只是针对每个用户而言,默认值:4096
apc.ttl = 0
缓存条目在缓冲区中允许逗留的秒数。0 表示永不超时。建议值为7200~36000。设为 0 意味着缓冲区有可能被旧的缓存条目填满,从而导致无法缓存新条目。默认值为:0
apc.user_ttl = 0
类似于apc.ttl,只是针对每个用户而言,建议值为7200~36000。默认值:0
apc.gc_ttl = 3600
缓存条目在垃圾回收表中能够存在的秒数。此值提供了一个安全措施,即使一个服务器进程在执行缓存的源文件时崩溃,而且该源文件已经被修改,为旧版本分配的内存也不会被回收,直到达到此TTL值为止。设为零将禁用。默认值3600
apc.cache_by_default = On
是否默认对所有文件启用缓冲。 若设为Off并与以加号开头的apc.filters指令一起用,则文件仅在匹配过滤器时才被缓存。默认值:On
apc.filters =
一个以逗号分隔的POSIX扩展正则表达式列表。如果源文件名与任意一个模式匹配,则该文件不被缓存。
注意,用来匹配的文件名是传递给include/require的文件名,而不是绝对路径。
如果正则表达式的第一个字符是"+"则意味着任何匹配表达式的文件会被缓存,如果第一个字符是"-"则任何匹配项都不会被缓存。"-"是默认值,可以省略掉。默认值:""
apc.max_file_size = 1M
禁止大于此尺寸的文件被缓存。默认值:1M
apc.num_files_hint = 1000
Web服务器上可能被包含或被请求的不同源文件的大致数量(建议值为1024~4096)。
如果你不能确定,则设为 0 ;此设定主要用于拥有数千个源文件的站点。
apc.write_lock = 1
是否启用写入锁。
apc.enable_cli = 1
主要用于测试和调试。这使APC的设置应用于PHP的CLI版本。
如果要看apc的使用情况可以把源码包下的apa.php拷贝到网站目录内在IE中打开,就可以看到apc状态的图表了。
本文来自http://blog.gsywx.com
APC的php扩展下载地址:
http://pecl.php.net/package/APC
wget http://pecl.php.net/get/APC-3.1.4.tgz
tar zxvf APC-3.1.4.tgz
cd APC-3.1.4
/web/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/web/php/bin/php-config
make
make install
返回:
Installing shared extensions: /web/php/lib/php/extensions/no-debug-non-zts-20060613/
vi /etc/php
查找extension_dir,在下面加上:
extension=apc.so
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 2048
apc.write_lock = On
apc.gc_ttl = 3600
apc.ttl= 7200
apc.enable_cli=1
相关参数说明:(完整的参数说明请查看INSTALL文件)
apc.enabled = 1
设置0可以禁用APC。主要当APC被静态编译到PHP时,没有其他的方法来禁用它,编制了zend_extension时可以注释掉。默认值为:1
apc.shm_segments = 1
为编译器缓冲区分配的共享内存块数量(建议值为1)。将其设置为1以外的值并没有影响模式的mmap,因为mmap'ed的SHM段没有大小限制。
如果APC耗尽了共享内存,并且已将apc.shm_size指令设为系统允许的最大值,你可以尝试增大此值。默认值为:1
apc.shm_size = 30
每个共享内存块的大小(以MB为单位,建议值为128~256)。
有些系统(包括大多数BSD)默认的共享内存块大小非常小。默认值为:30
apc.num_files_hint = 1000
Web服务器上可能被包含或被请求的不同源文件的大致数量(建议值为1024~4096)。
如果你不能确定,则设为 0 ;此设定主要用于拥有数千个源文件的站点。默认值为:1000
apc.user_entries_hint =4096
同apc.num_files_hint。只是针对每个用户而言,默认值:4096
apc.ttl = 0
缓存条目在缓冲区中允许逗留的秒数。0 表示永不超时。建议值为7200~36000。设为 0 意味着缓冲区有可能被旧的缓存条目填满,从而导致无法缓存新条目。默认值为:0
apc.user_ttl = 0
类似于apc.ttl,只是针对每个用户而言,建议值为7200~36000。默认值:0
apc.gc_ttl = 3600
缓存条目在垃圾回收表中能够存在的秒数。此值提供了一个安全措施,即使一个服务器进程在执行缓存的源文件时崩溃,而且该源文件已经被修改,为旧版本分配的内存也不会被回收,直到达到此TTL值为止。设为零将禁用。默认值3600
apc.cache_by_default = On
是否默认对所有文件启用缓冲。 若设为Off并与以加号开头的apc.filters指令一起用,则文件仅在匹配过滤器时才被缓存。默认值:On
apc.filters =
一个以逗号分隔的POSIX扩展正则表达式列表。如果源文件名与任意一个模式匹配,则该文件不被缓存。
注意,用来匹配的文件名是传递给include/require的文件名,而不是绝对路径。
如果正则表达式的第一个字符是"+"则意味着任何匹配表达式的文件会被缓存,如果第一个字符是"-"则任何匹配项都不会被缓存。"-"是默认值,可以省略掉。默认值:""
apc.max_file_size = 1M
禁止大于此尺寸的文件被缓存。默认值:1M
apc.num_files_hint = 1000
Web服务器上可能被包含或被请求的不同源文件的大致数量(建议值为1024~4096)。
如果你不能确定,则设为 0 ;此设定主要用于拥有数千个源文件的站点。
apc.write_lock = 1
是否启用写入锁。
apc.enable_cli = 1
主要用于测试和调试。这使APC的设置应用于PHP的CLI版本。
如果要看apc的使用情况可以把源码包下的apa.php拷贝到网站目录内在IE中打开,就可以看到apc状态的图表了。
利用scp自动输入密码进行文件远程拷贝或备份
[ 2010/09/02 22:13 | by admin ]
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com
要求:把192.168.0.3机上的/aa.tar.gz拷贝到192.168.0.2机器的/目录
具体操作:
在备份服务器上192.168.0.2
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
在被备份服务器上192.168.0.3
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
ssh 192.168.0.2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
在备份服务器上192.168.0.2
scp -rp root@192.168.0.3:/aa.tar.gz /
第一次执行会让输入确认"yes",以后就不用再输入了
此时可以把此命令放到计划任务中而自动执行了
crontab -e
本文来自http://blog.gsywx.com
要求:把192.168.0.3机上的/aa.tar.gz拷贝到192.168.0.2机器的/目录
具体操作:
在备份服务器上192.168.0.2
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
在被备份服务器上192.168.0.3
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
ssh 192.168.0.2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
在备份服务器上192.168.0.2
scp -rp root@192.168.0.3:/aa.tar.gz /
第一次执行会让输入确认"yes",以后就不用再输入了
此时可以把此命令放到计划任务中而自动执行了
crontab -e
proftpd的安装脚本
[ 2010/09/02 10:16 | by admin ]
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com
程序可以从官方下载
下载地址:
http://www.proftpd.org/
默认约定:
程序安装位置为 :/web/proftpd
创建用户为 :www
www家目录为 :/home/wwwroot/htdocs
www密码在安装过程中手工输入
脚本代码如下:
#!/bin/bash
clear
echo "----------------proftpd安装程序,按任意键继续---------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
char=`get_char`
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.3a.tar.gz
tar zxvf proftpd-1.3.3a.tar.gz
cd proftpd-1.3.3a
./configure --prefix=/web/proftpd
make
make install
mkdir -p /home/wwwroot/htdocs
groupadd www
useradd www -g www -d /home/wwwroot/htdocs -s /sbin/nologin
echo "Please input new password for user: www"
passwd www
chown -R www.www /home/wwwroot/htdocs
cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
sed -i 's\PATH="$PATH:/usr/local/sbin"\PATH="$PATH:/web/proftpd/sbin"\g' /etc/rc.d/init.d/proftpd
chmod +x /etc/rc.d/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on
cd ../
mv /web/proftpd/etc/proftpd.conf /web/proftpd/etc/proftpd.conf.bak
cp proftpd.conf /web/proftpd/etc/
service proftpd start
echo "删除安装临时文件.............."
rm -Rf proftpd-1.3.3a
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| useradd 用户名 -g 用户组 -d 用户家目录 -s /sbin/nologin |"
echo " -------------------------- proftpd 安装结束! -------------------------"
echo
echo
echo
echo
安装过程中的proftpd.conf为直接拷贝,请先行在安装目录创建profptd.conf,代码如下:
本文来自http://blog.gsywx.com
程序可以从官方下载
下载地址:
http://www.proftpd.org/
默认约定:
程序安装位置为 :/web/proftpd
创建用户为 :www
www家目录为 :/home/wwwroot/htdocs
www密码在安装过程中手工输入
脚本代码如下:
#!/bin/bash
clear
echo "----------------proftpd安装程序,按任意键继续---------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
char=`get_char`
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.3a.tar.gz
tar zxvf proftpd-1.3.3a.tar.gz
cd proftpd-1.3.3a
./configure --prefix=/web/proftpd
make
make install
mkdir -p /home/wwwroot/htdocs
groupadd www
useradd www -g www -d /home/wwwroot/htdocs -s /sbin/nologin
echo "Please input new password for user: www"
passwd www
chown -R www.www /home/wwwroot/htdocs
cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
sed -i 's\PATH="$PATH:/usr/local/sbin"\PATH="$PATH:/web/proftpd/sbin"\g' /etc/rc.d/init.d/proftpd
chmod +x /etc/rc.d/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on
cd ../
mv /web/proftpd/etc/proftpd.conf /web/proftpd/etc/proftpd.conf.bak
cp proftpd.conf /web/proftpd/etc/
service proftpd start
echo "删除安装临时文件.............."
rm -Rf proftpd-1.3.3a
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| useradd 用户名 -g 用户组 -d 用户家目录 -s /sbin/nologin |"
echo " -------------------------- proftpd 安装结束! -------------------------"
echo
echo
echo
echo
安装过程中的proftpd.conf为直接拷贝,请先行在安装目录创建profptd.conf,代码如下:
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName "Welcome to my Proftpd"
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
# Don't use IPv6 support by default.
UseIPv6 off
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User nobody
Group nobody
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#欢迎登录 ProFTPD
DefaultRoot ~
# Normally, we want files to be overwriteable.
#允许被写入覆盖
AllowOverwrite on
#下载允许断点续传
AllowRetrieveRestart on
#上传允许断点续传
AllowStoreRestart on
UseReverseDNS off
IdentLookups off
#设置ftp登陆欢迎信息文件
#DisplayLogin welcome.msg
#屏蔽服务器版本信息
#ServerIdent off
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>
#以上为全局配置
#以下为具体目录权限配置
<Directory /home/wwwroot/htdocs/>
<Limit SITE_CHMOD>
AllowAll
</Limit>
AllowRetrieveRestart on
AllowOverwrite on
AllowStoreRestart on
</Directory>
# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
# User ftp
# Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
# MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot
# <Limit WRITE>
# DenyAll
# </Limit>
#</Anonymous>
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName "Welcome to my Proftpd"
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
# Don't use IPv6 support by default.
UseIPv6 off
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User nobody
Group nobody
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#欢迎登录 ProFTPD
DefaultRoot ~
# Normally, we want files to be overwriteable.
#允许被写入覆盖
AllowOverwrite on
#下载允许断点续传
AllowRetrieveRestart on
#上传允许断点续传
AllowStoreRestart on
UseReverseDNS off
IdentLookups off
#设置ftp登陆欢迎信息文件
#DisplayLogin welcome.msg
#屏蔽服务器版本信息
#ServerIdent off
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>
#以上为全局配置
#以下为具体目录权限配置
<Directory /home/wwwroot/htdocs/>
<Limit SITE_CHMOD>
AllowAll
</Limit>
AllowRetrieveRestart on
AllowOverwrite on
AllowStoreRestart on
</Directory>
# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
# User ftp
# Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
# MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot
# <Limit WRITE>
# DenyAll
# </Limit>
#</Anonymous>