centos 6环境下安装mcrypt方法

centos 6环境下正常没有mcrypt的yum安装包
网站各种方法中,都是引用epel-release-6-5.noarch.rpm,这个文件现在是不存在的
经操作操作,以下方法可行:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
yum -y install mcrypt php-mcrypt mbstring php-mbstring
 service httpd restart

php -m 检查

(转)Mangento速度优化(加速)完整攻略,完整大全,总结的经验

1.开启Gzip,去掉网站根目录下.htaccess部分代码注释,修改成如下形式:(这个不是很理解)
第一部分:

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_ssl.c>
############################################

第二部分:

## enable resulting html compression
php_flag zlib.output_compression on

第三部分:
在php.ini中将zlib.output_compression = Off改为zlib.output_compression = On

2.在my.cnf中修改或添加如下代码:(修改Mysql服务器的配置好好利用服务器的内存)

key_buffer = 512M
max_allowed_packet = 64M
table_cache = 512
sort_buffer_size = 4m
read_buffer_size = 4m
read_rnd_buffer_size = 2m
myisam_sort_buffer_size = 64m
tmp_table_size = 128m
query_cache_size = 96m
query_cache_type = 1
thread_cache_size = 8
max_connections = 400
wait_timeout = 300

3.给文件指定有效期
网站根目录.htaccess最后添加:

<ifmodule mod_headers.c>
<filesmatch “\.(html|htm|txt)$”>
header set cache-control “max-age=3600″
</filesmatch>
<filesmatch “\.(css|js|swf)$”>
header set cache-control “max-age=86400″
</filesmatch>
<filesmatch “\.(ico|gif|png|flv|pdf)$”>
header set cache-control “max-age=86400″
</filesmatch>
<filesmatch “\.(jpeg|jpg)$”>
header set cache-control “max-age=86400″
</filesmatch>
</ifmodule>

4.关闭Etag
网站根目录.htaccess添加:

FileETag none

5.-bash: pecl: command not found的解决方法
-bash: pecl: command not found
出现这个问题是因为没有安装php的扩展开发导致的,建议将php以及apache的开发都安装上,使用如下的命令。
yum install php-devel php-pear httpd-devel

6.Centos6.0安装APC
安装: 命令行输入:
pecl install apc
如果报错-bash: pecl: command not found,参看上面一条,第5条
安装完毕后在/usr/lib/php/modules中出现apc.so
然后在/etc/php.ini中加入:
extension=apc.so
重启Apache
phpinfo出来APC的相关内容
在php.ini 中重新配置如下:

[apc]
extension = apc.so
apc.cache_by_default = On
apc.coredump_unmap = Off
apc.enable_cli = 0
apc.enabled = 1
apc.file_update_protection = 2
apc.filters = “”
apc.gc_ttl = 3600
apc.include_once_override = Off
apc.max_file_size = 5M
apc.mmap_file_mask = “”
apc.num_files_hint = 1000
apc.report_autofilter = Off
apc.shm_segments = 2
apc.shm_size = 512
apc.slam_defense = 0
apc.stat = On
apc.stat_ctime = Off
apc.ttl = 0
apc.user_entries_hint = 4096
apc.user_ttl = 0
apc.write_lock = On

安装好APC后,在Magento中app/etc/local.xml中加入下面的代码:

 <global>
………….
     <cache>
          <backend>apc</backend>
          <prefix>MAGE01_</prefix>
     </cache>
 </global>
…………………………….

7.将magento的缓存挂载到内存, 提高读取速度
将magento的cache和session文件夹mount到内存里, 提高读取cache和session的速度
mount -t tmpfs -o size=256M,mode=0777 tmpfs /你网站存放文件夹/var/cache/
mount -t tmpfs -o size=64M,mode=0777 tmpfs /你网站存放文件夹/var/session/
#注意修改为你的文件夹路径,为了能够重启后生效,请在/etc/fstab文件里加入
tmpfs  /你网站存放文件夹/var/cache/ tmpfs size=256,mode=0777 0 0
tmpfs /你网站存放文件夹/var/session/ tmpfs size=64,mode=0777 0 0

8.设置apache 开启 KeepAlive
KeepAlive = On
LoadModule deflate_module modules/mod_deflate.so #开启mod_deflate

来源:http://www.wujinlin.com/mangento%E9%80%9F%E5%BA%A6%E4%BC%98%E5%8C%96-%E5%8A%A0%E9%80%9F-%E5%AE%8C%E6%95%B4%E6%94%BB%E7%95%A5/

Magento:新模块的xml配置中设置title,keywords,description内容

当使用插件,或许会新建一个页,这时如何在方便的页中设置指定的title,keywords,description呢,一种当然是在代码中直接进行设置,但有一个更方便的方法,就是在xml中进行设置
代码如下:

<reference name="head">
    <action method="setTitle"><title>新模块标题</title></action>
    <action method="setKeywords"><title>your, module, keywords</title></action>
    <action method="setDescription"><title>Your Module Description</title></action>
</reference>