Blog

  • mysql启动失败

    /usr/sbin/mysqld status

    提示

    lc-messages-dir=/usr/share/mysql

    http://www.dotdeb.org/2011/11/01/mysql-5-5-is-finally-here/ 给出了解决方法

    在my.cnf中注释掉就可以了

    "The mysql-common package will be upgraded to version 5.5.17. It’s no
    big deal, it only contains retro-compatible configuration files."
    Wrong. The my.cnf delivered by mysql-common-5.5 contains the
    lc-messages-dir setting, which MySQL Server 5.1 cannot understand
    and will fail to start.To everyone who upgraded mysql-common to 5.5,
    but left mysql-server unchanged: Comment out the lc-messages-dir
    setting in my.cnf OR YOUR MYSQL SERVER WILL FAIL TO START.
    
     Best regards,
     Tobias
  • jQuery笔记

    所有jQuery位于下面函数中,为了防止文档在完全加载(就绪)之前运行 jQuery 代码

    $(document).ready(function(){
    
    --- jQuery functions go here ----
    
    });

    jQuery 有元素选择器和属性选择器

     

  • 不是觉得百来块的书贵么

    买到一包假南京烟

    十一块五浪费了

    不是觉得百来块的书贵么

    抽十来包烟,就能买一本,还觉得贵么?

  • 安装php5扩展模块eaccelerator

    首先下载eaccelerator最新版

    wget http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2

    网上的教程说要有/usr/local/php/bin/phpize,但是我的vps上的php是apt-get的没有怎么办?

    搜索得知要安装php5-dev才会有phpize,还要安装autoconf,automake

    apt-get install php5-dev autoconf automake

    安装到最后提示了

    update-alternatives: using /usr/bin/php-config5 to provide /usr/bin/php-config (php-config) in auto mode.
    update-alternatives: using /usr/bin/phpize5 to provide /usr/bin/phpize (phpize) in auto mode.

    既然给了上面的提示,就用带5的

    准备工作差不多了开始安装

    tar jxvf eaccelerator-0.9.6.1.tar.bz2
    cd eaccelerator-0.9.6.1
    /usr/bin/phpize5
    ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config5
    make
    make install

    提示说 Installing shared extensions:     /usr/lib/php5/20090626+lfs/

    这样创建缓存目录

    mkdir /tmp/eaccelerator
    chmod 777 /tmp/eaccelerator

    这时编辑/etc/php5/fpm/php.ini在最后加入如下代码

    配置项更具体准确的含义来自:https://eaccelerator.net/wiki/Settings

    vim /etc/php5/fpm/php.ini
    [eaccelerator]
    zend_extension="/usr/lib/php5/20090626+lfs/eaccelerator.so"
    eaccelerator.shm_size="32"
    eaccelerator.cache_dir="/tmp/eaccelerator"
    eaccelerator.enable="1"
    eaccelerator.optimizer="1"
    eaccelerator.check_mtime="1"
    eaccelerator.debug="0"
    eaccelerator.filter=""
    eaccelerator.shm_max="0"
    eaccelerator.shm_ttl="300"
    eaccelerator.shm_prune_period="120"
    eaccelerator.shm_only="0"
    eaccelerator.compress="1"
    eaccelerator.compress_level="9"

    重启下php5-fpm

    /etc/init.d/php5-fpm restart

    如何检测呢,搞一个phpinfo();

    eAccelerator 这一节的描述

    这时进到/tmp/eaccelerator会发现有不少的目录

    收获:

    有空的话还是要不怕麻烦编译安装,这样对程序会更熟悉

    不要从不靠谱的网上直接复制配置文件,复制过来的双引号全是中文的

    续:

    按wiki里面说的我查看了下最大共享大小

    cat /proc/sys/kernel/shmmax

    得到33554432

    用expr除了两次:

    expr 33554432 \/ 1024
     32768
     expr 32768 \/ 1024
     32

    而这样按配置设置64,php5-fpm就不能重启成功

    比如想弄成64,则

    echo 67108864 > /proc/sys/kernel/shmmax

    效果如何?

    不会测试,网上人说的是ea的作用就是让缓存里php文件不需要再次编译,这一点我觉得有可能吧

  • 本博客支持ipv6访问!

    本博客支持ipv6访问!

    最近nginx要升级1.1.7,而且vps支持ipv6,并送了一个ipv6地址

    正好学校里有ipv6上网环境,大致步骤是加入ipv6模块,并在nginx的配置里加入ipv6监听,使用ipv6可以直接访问

    nginx的升级和加入ipv6模块

    wget http://nginx.org/download/nginx-1.1.7.tar.gz
     tar vxzf nginx-1.1.7.tar.gz
     cd nginx-1.1.7
     ./configure --with-ipv6
     make
     mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
     cp objs/nginx /usr/local/nginx/sbin/nginx
     make upgrade

    测试下配置文件:/usr/local/nginx/sbin/nginx -t

    查看下,已经添加了ipv6模块

    root@www:~# nginx -V
     nginx: nginx version: nginx/1.1.7
     nginx: built by gcc 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
     nginx: configure arguments: --with-ipv6

    nginx的配置文件

    里面加入下面指令,如果是默认网站的话加default

    listen [::]:80 default;

    http://[2604:6600:1059::5810:3a0a]/

    重新加载配置文件

    kill -HUP `cat /usr/local/nginx/logs/nginx.pid`

    不要用nginx -s reload 我用了不管用

    在域名提供商那里加入ipv6的AAAA记录

    godaddy AAAA record

    去 http://ipv6-test.com/  加一张认证图过来

    blog support ipv6 visit

     

    :)EOT

     

  • 安装php5-gd库

    在自已的vmplayer里面装了一个oecms,但是装好后验证码始终出不来,ie下显示一个红叉,火狐下显示空白。

    开始我想会不会是因为缓存和目录权限的问题

    后来看了看php代码发现里面直接就是image/PNG,我一想,应该是php库没装全,于是去网上搜了一下,这个库包含了libjpeg,libpng

    于是

    apt-get install php5-gd

    问题解决。

    PHP处理图像,使用了GD库,它使php支持 gif , jpeg , ttf ,wbmp

    :)EOT