为 php 安装eAccelerator 加速器 

有了php,一个加速器也是需要的。
所谓加速器,就是通过缓存方式把已编译好php字节码放在内存里,以便提高程序的执行、响应效率.

总之,速度是绝对上去了。

我选择的是开源的eAccelerator,而不是广泛使用的Zend Optimizer.

首先,下载最新的svn snapshots 版本,http://snapshots.eaccelerator.net/

解压,进入目录.

运行 phpize,生成安装文件.

我的configure:
$ ./configure --prefix=/usr/local/eaccel --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-eaccelerator

更多参数见:http://www.eaccelerator.net/wiki/CompileConfiguration
如果系统里安装有多个php版本,可能要指定php-config 路径

检查依赖没有问题,之后 make && make install.OK了

eAccelerator安装成功.

然后,打开源码目录下的 eaccelerator.ini,把里面的内容通通复制到 php.ini 里面.

稍加编辑,如

; eAccelerator extension.
extension="eaccelerator.so"
(作为php 扩展安装)
;zend_extension="/usr/lib/php/modules/eaccelerator.so"
(作为Zend 扩展安装)
;zend_extension_ts="/usr/lib/php/modules/eaccelerator.so"
(作为Zend 扩展安装,适用于 php 的线程安全版)

eaccelerator.shm_size="16"
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="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

更多设置见:http://www.eaccelerator.net/wiki/Settings

保存之后,确保 php 对缓存目录/tmp/eaccelerator 有读写权限后.
chmod 0777 /tmp/eaccelerator

重启php-cgi 进程 或者 web server,即可启用加速器了.

运行 php -v 查看版本,
有 "by eAccelerator" 字样说明启用成功.
如:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

更多介绍见:http://www.eaccelerator.net/wiki/InstallFromSource
[ ] ( 2236 次浏览 ) 永久链接 ( 3 / 2368 )
编译安装 PHP 5.3.2 + php-fpm 通过 

真的是好事成双。

刚刚写完上一篇文章,就收到了PHP Bug Database的提醒,我提交的问题被解决了

原来是因为 我既启用了 php 内置的 mysqli,又自己编译了mysqli扩展.

导致php 遭遇Segmentation fault....

以后这个问题要注意呀,呵呵

为什么要用php-fpm ,因为fastcgi已经很久不更新了.
而且从 php 5.3.x 分支开始,php-fpm 已经成为了php内部项目了。
可见其前景无限.

下载 php 5.3.2源码包,解压,进入目录.
检出php-fpm 源码:
svn co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm sapi/fpm

并重新生成configure文件,
./buildconf --force

我的configure:

$ ./configure --prefix=/usr/local/php --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-embed=static --enable-fpm --enable-debug --enable-safe-mode --enable-sigchild --enable-magic-quotes --enable-fd-setsize=100 --enable-calendar --enable-dba=shared --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-mbstring --enable-pcntl --disable-phar --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --enable-zend-multibyte --with-libxml-dir --with-libevent-dir=/usr/local/libevent --with-fpm-user=http --with-fpm-group=web --with-config-file-path=/etc --with-exec-dir=/usr/local/bin --with-openssl --with-kerberos --with-pcre-regex --with-zlib --with-bz2 --with-curl --with-gd --with-mhash --with-imap --with-imap-ssl --with-ldap --with-ldap-sasl --with-mcrypt --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/local/bin/mysql_config --with-pdo-mysql=/usr/local/bin/mysql_config --with-xmlrpc --without-pear

检查依赖,报错:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing

yum install libc-client-devel.i386

解决.

接下了,make && make install.

如果编译通过,make 报错,make: *** [ext/phar/phar.php] Error 139
那是因为没有禁用掉 phar.
这是个php已知的bug(http://bugs.php.net/bug.php?id=51216),只有等下一个版本修复了.

安装OK后,复制源码包下sapi/fpm/php-fpm.conf 到 /etc/sysconfig/ 下,
稍加编辑,即可

运行 php-fpm,成功跑起来.
[ ] ( 2567 次浏览 ) 永久链接 ( 3 / 2244 )
编译安装 Squid 3.1.1 通过 

这几天搞php搞得头昏,已经把遇到的问题提交到了 http://bugs.php.net/,等回答了

故决定先把php放一放。

于是便寻思着去为即将问世的web server 做一个缓存系统.

因为我的VPS流量是1TB,说大不大,说小也不小。所以搞个缓存机制也是可行的。

于是便瞄准了squid-cache 这个工具.

下载最新的3.1.1版本,解压,进入源码包

我的configure:

It was created by Squid Web Proxy configure 3.1.1, which was
generated by GNU Autoconf 2.62. Invocation command line was

$ ./configure --prefix=/usr/local/squid --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-icmp --enable-delay-pools --enable-esi --enable-icap-client --enable-ecap --enable-cachemgr-hostname=PowerPC --enable-arp-acl --enable-ssl --enable-cache-digests --enable-follow-x-forwarded-for --enable-stacktraces --with-default-user=cache

可能会要求安装iptables,不过那台linux系统里没有呢?

有个安装cppunit的警告,只要不需要 make check,该依赖不是必须的。

检查依赖通过,make && make install

安装成功.

完了之后,编辑/etc/sysconfig/squid.conf 文件.

因为我这个squid 只是用来做web 缓存的,所以只需要设置反向代理即可.
在配置文件顶上面加入下面几行:

http_port 80 accel defaultsite=184.82.15.110 vhost
#由于暂时没有域名指向,直接用ip
cache_peer 184.82.15.110 parent 81 0 no-query originserver name=myAcce
#我lighttpd 的端口是81
cache_peer_access myAccel allow all
#暂时没有接入规则

更多设置见:http://wiki.squid-cache.org/ConfigExamples/

保存退出后。
运行 squid -z 生成缓存数据 (确保squid uid 对目录有读写权限)
最后,运行 squid,启动缓存.

访问下 http://184.82.15.110,看看返回体。

HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: 5794
Date: Mon, 19 Apr 2010 10:28:33 GMT
Server: lighttpd/1.4.26
X-Cache: MISS from PowerPC
X-Cache-Lookup: MISS from PowerPC:80
Via: 1.0 PowerPC (squid/3.1.1)
Connection: keep-alive

果然squid 开始工作了
___________________
访问 http://184.82.15.110:81/,返回体

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 5794
Date: Mon, 19 Apr 2010 10:53:29 GMT
Server: lighttpd/1.4.26

无缓存.
[ ] ( 1576 次浏览 ) 永久链接 ( 3 / 2249 )
编译安装 ProFTPD 1.3.3 通过 

想到为VPS安装一个ftp是必须的,于是便动手了.
因为proftpd没有用过,便想试试.
据说它提供像apache 那样的配置文件格式,很是友好

我的configure:
$ ./configure --prefix=/usr/local/proftpd --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-autoshadow --enable-nls --enable-openssl --enable-shadow --enable-buffer-size --enable-pool-size --enable-timeout-idle=180 --enable-transfer-buffer-size

检查依赖,缺openssl.故而 yum install openssl-devel

再次检查,通过

make && make install. 一切OK

然后复制源码包下的contrib下的几个几个第三方工具(如 ftpasswd) 到/usr/local/bin 下

再在 sample-configurations 下复制最适合自己的配置文件到 /etc/sysconfig 下,并改名为proftpd.config

因为我是私人的ftp,而且用的人很少,故选择 basic.conf.

接下来配置ftp虚拟用户,发现proftpd支持像vsftpd那样的通过mod_pam 连接mysql 验证用户.

不过,我比较喜欢通过本地文件存储用户信息.

编辑 proftpd.config 文件,加入

AuthUserFile /etc/proftpd.passwd
#定位用户信息存储文件路径
AuthOrder mod_auth_file.c mod_auth_unix.c
#指明验证方式.一定要有,不要像我一样,总是登不进去

use 和 group 可以自己指定.
我用的是系统自带的 ftp:ftp.
uid 14 ,giu 50

这个好了后,可以用第三方工具ftpasswd 添加虚拟用户.

ftpasswd -passwd --name=admin --uid=14 --gid=50 --home=/home --shell=/sbin/nologin --file=/etc/proftpd.passwd

输入两次密码即可,设置成功.

proftpd -t 测试一下配置文件
proftpd 启动ftp

ftp 127.0.0.1,输入用户名密码,登录成功
[ ] ( 2874 次浏览 ) 永久链接 ( 3 / 2408 )
源码安装 mysql 5.5.4-m3 

mysql刚刚发布了5.5 分支的第四个里程碑版本,于是下载安装.
前几天只有 x86_64 for linux 版本,今天已经放出了了i686版本.

我的configure:

It was created by MySQL Server configure.am 5.5.4-m3, which was
generated by GNU Autoconf 2.63. Invocation command line was

$ ./configure.am --prefix=/usr/local/mysql --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-profiling --with-charset=utf8 --with-extra-charsets=all --with-system-type=PowerOS --with-machine-type=PowerPC --with-mysqld-user=mysql --with-zlib-dir=bundled --with-low-memory --with-big-tables --with-ssl --with-embedded-server --with-embedded-privilege-control

检查依赖通过,但是在生成安装文件的时候,有了一行错误.
/bin/rm: cannot remove `libtoolT’: No such file or directory

查了一下,不影响安装.不过要再次生成conf 文件.

后来在源码包下INSTALL-SOURCE里面发现了源码编译前的准备步骤,可以避免这个错误.

2. Prepare the source tree for configuration:
shell> autoreconf --force --install
#发现autoconf 工具没装.
As an alternative to the preceding autoreconf command,
you can use BUILD/autorun.sh, which acts as a shortcut
for the following sequence of commands:
shell> aclocal; autoheader
shell> libtoolize --automake --force
#发现libtool 工具没装.
shell> automake --force --add-missing; autoconf
#发现automake 工具没装.

If you get some strange errors during this stage, verify
that you have the correct version of libtool installed.
删除源码文件夹,重新解压了下。
按照提示的步骤,走下去

检查依赖的时候,libtoolT 的错误的确没有了

不过,make 的时候居然报错了……囧rz

报zilb找不到,我日啊,我设置的zlib是mysql集成的,居然问我要zlib 库....

这个问题一时还找不到解决方案.

所幸libtoolT那个错误不影响安装使用,先忽略.以后再议.

接下来:
shell> groupadd mysql
shell> useradd -g mysql mysql
创建mysql 用户 组
shell> cp support-files/my-medium.cnf /etc/my.cnf
复制配置文件
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> mysql_install_db --user=mysql
安装初始数据.
shell> chown -R root .
shell> chown -R mysql var
shell> mysqld_safe --user=mysql &
成功启动mysql.
[ ] ( 1597 次浏览 ) 永久链接 ( 3.1 / 2183 )

<< <上一页 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 下一页> >>