发布一个基于 Zend Framework 的开源项目 momoger.com
作开源工作很累。 这个项目是我在新公司给同事们介绍 Zend Framework 用的示例项目。 可惜效果不是很理想。具体的就不说了。
项目源码发布到 google code 上。 项目地址为: http://code.google.com/p/momoger/
喜欢学习 Zend Framework 的同学可以下载去看看, 这个例子还是比较全面的。 以后有时间可能把其他的方面也开发进来。
建议先看项目里的 documents/readme.txt , 关键的说明我都写在里面了。
有问题和已经可以和我交流。 呵呵!
PHP5.3.0 正式发布, 超级爽!
今天晚上打开 php.net 一看, 5.3.0 的正式版已经发布。 刚刚手头有台机器刚装了 ubuntu, 编译了一下 LAMP 系统, PHP 5.3.0 改动比较大。 第一眼看到的 php.ini 文件里已经变动了。 感觉比一以前版本的舒服点了。 有了开发环境和生产环境的配置区分了。 详细的以后慢慢了解了。 貌似增强了很多功能。 从 phpinfo() 里看出来的。 放出一张刚测试出的phpinfo()截图, 后面张贴一下本次编译的命令记录。
看看编译的一堆命令。 有需要的朋友可以拿去参考一下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | sudo apt-get install build-essential gcc make autoconf automake1.9 libtool sudo apt-get install zlib1g-dev libdb-dev tar -jxf apr-1.3.5.tar.bz2 -C ../builds/ tar -jxf apr-util-1.3.7.tar.bz2 -C ../builds/ tar -zxf httpd-2.2.11.tar.gz -C ../builds/ cd ../builds/ cd apr-1.3.5/ ./configure make sudo make install cd ../apr-util-1.3.7/ ./configure --with-apr=/usr/local/apr --with-berkeley-db=/usr make sudo make install cd ../httpd-2.2.11/ ./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-dav=shared --enable-so --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config make sudo make install sudo apt-get install libxml2 libxml2-dev tar -zxf neon-0.28.4.tar.gz -C ../builds/ tar -zxf zlib-1.2.3.tar.gz -C ../builds/ tar -zxf expat-2.0.1.tar.gz -C ../builds/ tar -zxf subversion-1.6.2.tar.gz -C ../builds/ mkdir ../builds/subversion-1.6.2/sqlite-amalgamation tar -zxf sqlite-amalgamation-3.6.13.tar.gz cp sqlite-3.6.13/sqlite3.c ../builds/subversion-1.6.2/sqlite-amalgamation/ rm -rf sqlite-3.6.13 cd ../builds/neon-0.28.4/ ./configure make sudo make install cd ../zlib-1.2.3/ ./configure --prefix=/usr/local/zlib make sudo make install cd ../expat-2.0.1/ ./configure make sudo make install cd ../subversion-1.6.2/ ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-neon=/usr/local --with-zlib=/usr/local/zlib --with-ssl make sudo make install tar -zxf mysql-5.0.83-linux-i686-icc-glibc23.tar.gz sudo mv mysql-5.0.83-linux-i686-icc-glibc23 /usr/local/mysql cd /usr/local/mysql/ sudo groupadd mysql sudo useradd -g mysql mysql sudo scripts/mysql_install_db --user=mysql sudo chown -R mysql . sudo chgrp -R mysql . sudo chown -R root . sudo chown -R mysql data cd support-files/ sudo cp my-medium.cnf /etc/my.cnf sudo gedit /etc/my.cnf sudo ./mysql.server start cd ../bin ./mysqladmin -u root password 'mypassword' ./mysql -u root -p cd ../support-files/ sudo ./mysql.server stop sudo apt-get install flex libpng12-0 libpng12-dev libltdl3-dev sudo ln -sf libpng12.so.0 libpng.so tar -zxf curl-7.19.5.tar.gz -C ../builds/ tar -zxf jpegsrc.v6b.tar.gz -C ../builds/ tar -zxf freetype-2.3.9.tar.gz -C ../builds/ tar -zxf libmcrypt-2.5.8.tar.gz -C ../builds/ tar -zxf mhash-0.9.9.9.tar.gz -C ../builds/ tar -zxf php-5.3.0.tar.gz -C ../builds/ cd ../builds/curl-7.19.5/ sudo mkdir /usr/local/curl ./configure --prefix=/usr/local/curl --with-ssl make sudo make install cd ../jpeg-6b/ sudo mkdir /usr/local/jpeg sudo mkdir /usr/local/jpeg/bin sudo mkdir /usr/local/jpeg/lib sudo mkdir /usr/local/jpeg/include sudo mkdir /usr/local/jpeg/man sudo mkdir /usr/local/jpeg/man/man1 ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static make sudo make install cd ../freetype-2.3.9/ ./configure --prefix=/usr/local/freetype2 make sudo make install cd ../libmcrypt-2.5.8/ ./configure --prefix=/usr/local/libmcrypt make sudo make install cd ../mhash-0.9.9.9/ ./configure --prefix=/usr/local/libmhash make sudo make install cd ../php-5.3.0/ ./configure --prefix=/usr/local/php \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-config-file-path=/usr/local/php \ --with-openssl \ --with-zlib \ --with-zlib-dir=/usr/local/zlib \ --enable-bcmath \ --enable-calendar \ --with-curl=/usr/local/curl \ --with-curlwrappers \ --enable-ftp \ --with-gd \ --with-jpeg-dir=/usr/local/jpeg \ --with-png-dir=/usr \ --with-freetype-dir=/usr/local/freetype2 \ --enable-gd-native-ttf \ --with-gettext \ --with-mcrypt=/usr/local/libmcrypt \ --with-mhash=/usr/local/libmhash \ --enable-mbstring \ --enable-exif \ --with-mysql=/usr/local/mysql \ --with-pdo-mysql=/usr/local/mysql \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-xmlrpc \ --enable-soap \ --enable-sockets \ --enable-zip sudo cp php.ini-development /usr/local/php/php.ini sudo gedit /usr/local/apache2/conf/httpd.conf |
OK, 玩过头了。 赶紧睡觉先!
分享2个 PHP 十进制和二进制互转的函数
有时候想看一个整数的二进制数据换算挺麻烦的. 留2个函数方便使用.
从十进制转成二进制.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * 有符号整型数据转换成二进制形式. * * @param int $si 要转换的整型数据 * @param int $bits 计算机CPU位宽 * @return string */ function si2bin($si, $bits=32) { //检查数据大小是否在范围内. if ($si >= -pow(2,$bits-1) and $si <= pow(2,$bits-1) ){ if ($si < 0) { $si = -$si-pow(2,$bits); } $bin = base_convert($si,10,2); $bin_length = strlen($bin); if ($bin_length < $bits) $bin = str_repeat ( "0", $bits-$bin_length).$bin; return $bin; } return ''; } |
从二进制转到十进制:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * 二进制数据转换成有符号整数. * * @param string $bin 二进制数据 * @param int $bits 计算机CPU位宽 * @return int */ function bin2si($bin,$bits=32) { if (strlen($bin)==$bits) { $si = base_convert($bin,2,10); if (substr($bin,0,1) == 1) { //负数 $si = -(pow(2,$bits)-$si); } return $si; } return 0; } |
快速搭建Linux开发测试WEB服务器系列12-Nginx部署实例
这篇我们利用虚拟机搭建一套测试服务器系统. 其实主要是测试 Linux + Nginx + PHP(FasgCGI) + MySQL 这套系统.前篇简单的说了下 Nginx 的配置. 这里我们根据实际的情况详细的介绍 Nginx 配置文件的设置.
我们打算用虚拟机搭建一套下面的图示系统. 见图:

大概意思图上应该已经表示的非常的清楚了. 其实稍加修改, 可以作为中小型的WEB服务器参考方案. 而且效果也会非常的不错.
接下来用虚拟机就可以实现上面的环境, 后续文章我们相继再介绍. 不过这个需要个比较好的电脑, 像我这个 赛扬1.4, 945的板子 另加 1.5G 的内存的古董本本可能模拟起来有点难度. 不过先试试看了. 下篇我们就开始创建这些虚拟服务器了.
