Monthly Archives: 二月 2010

mb_substr修正函数

不支持mb_substr函数的环境中使用了mb_substr函数会出现“Fatal error: Call to undefined function mb_substr()”的提示,下面的函数是定义的替代mb_substr的函数,作用是一样的,用于不支持mb_substr的地方。 // Patch in multibyte support if (!function_exists(‘mb_substr’)) { function mb_substr($str, $start, $len = ”, $encoding="UTF-8"){ $limit = strlen($str); for ($s = 0; $start > 0;–$start) {// found the real start if ($s >= … Continue reading

Posted in Code | Tagged , , , | 5 Comments [381 views]

eAccelerator-0.9.6安装笔记

cd tmp wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2 tar -jxvf eaccelerator-0.9.6.tar.bz2 cd eaccelerator-0.9.6 /usr/bin/phpize ./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config make make install (注:以上文中“phpize”以及“php-config”的路径如果不知道可以使用find命令事先查找一下。) 安装完毕编辑php.ini将其安装为 PHP extension 模式 在php.ini中添加如下: extension="eaccelerator.so" eaccelerator.shm_size="16" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.log_file = "/var/log/httpd/eaccelerator_log" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" 最后创建/tmp/eaccelerator目录 … Continue reading

Posted in Code | Tagged , , | 评论关闭 [100 views]