5月 062013
 

编译安装apache

[root@localhost ~]# yum install perl gcc make
[root@localhost ~]# groupadd -r apache
[root@localhost ~]# useradd -r -M -g apache apache
[root@localhost ~]# tar xzf httpd-2.2.24.tar.gz
[root@localhost ~]# cd httpd-2.2.24
[root@localhost httpd-2.2.24]# ./configure --prefix=/usr/local/apache \
 > --enable-so --enable-rewrite
[root@localhost httpd-2.2.24]# make
[root@localhost httpd-2.2.24]# make install

编译安装php

[root@localhost ~]# tar xzf php-5.2.17.tar.gz
[root@localhost ~]# cd php-5.2.17
[root@localhost php-5.2.17]# yum install libxml2-devel
[root@localhost php-5.2.17]# yum install gd-devel libpng-devel libjpeg-devel
[root@localhost php-5.2.17]# ./configure --prefix=/usr/local/php \
 > --with-apxs2=/usr/local/apache/bin/apxs \
 > --enable-fastcgi --enable-mbstring \
 > --with-gd=/usr/ --with-png-dir=/usr/ --with-jpeg-dir=/usr/
[root@localhost php-5.2.17]# make
[root@localhost php-5.2.17]# make install
[root@localhost php-5.2.17]# cp php.ini-dist /usr/local/php/lib/php.ini

编译安装nginx

[root@localhost ~]# tar xzf nginx-1.4.0.tar.gz
[root@localhost ~]# tar xzf openssl-1.0.1e.tar.gz
[root@localhost ~]# tar xzf zlib-1.2.8.tar.gz
[root@localhost ~]# tar xzf pcre-8.32.tar.gz
[root@localhost nginx-1.4.0]# cd nginx-1.4.0
[root@localhost nginx-1.4.0]# yum install gcc-c++
[root@localhost nginx-1.4.0]# ./configure --prefix=/usr/local/nginx \
 > --with-http_stub_status_module --with-http_ssl_module \
 > --with-pcre=../pcre-8.32/ --with-zlib=../zlib-1.2.8 \
 > --with-openssl=../openssl-1.0.1e
[root@localhost nginx-1.4.0]# make
[root@localhost nginx-1.4.0]# make install

修改nginx配置文件

#location ~ \.php$ {
 #    proxy_pass   http://127.0.0.1;
 #}
location ~ \.php$ {
 proxy_pass   http://127.0.0.1:8080;
 }

修改apache配置文件

[root@localhost ~]# vi /usr/local/apache/conf/httpd.conf
 Listen 8080
User apache
Group apache
ServerName 127.0.0.1:8080
<IfModule dir_module>
 DirectoryIndex index.php
</IfModule>
AddType application/x-httpd-php .php
#DocumentRoot "/usr/local/apache/htdocs"
DocumentRoot "/usr/local/nginx/html"
#<Directory "/usr/local/apache/htdocs">
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Order allow,deny
#    Allow from all
#</Directory>
<Directory "/usr/local/nginx/html">
 Options Indexes FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all
</Directory>

启动apache并查看监听

[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]# netstat -lutn |grep 8080
 tcp        0      0 :::8080                     :::*                        LISTEN
[root@localhost ~]#

启动nginx并查看监听

[root@localhost ~]# /usr/local/nginx/sbin/nginx
[root@localhost ~]# netstat -lut |grep http
 tcp        0      0 *:http                      *:*                         LISTEN
[root@localhost ~]#

创建php测试文件

[root@localhost ~]# vi /usr/local/nginx/html/hello.php
 <?php phpinfo(); ?>

nginx-apache-0201

访问http://192.168.244.135/index.html后的nginx日志记录

[root@localhost ~]# cat /usr/local/nginx/logs/access.log
192.168.244.1 - - [06/May/2013:16:53:22 +0800] "GET / HTTP/1.1" 200 612 "-"
 "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0"

nginx-apache-0202

访问http://192.168.244.135/hello.php后的apache日志记录

[root@localhost ~]# cat /usr/local/apache/logs/access_log
 127.0.0.1 - - [06/May/2013:19:09:00 +0800] "GET /hello.php HTTP/1.0" 200 43026
 127.0.0.1 - - [06/May/2013:19:09:00 +0800] "GET
 /hello.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.0" 200 2524
 127.0.0.1 - - [06/May/2013:19:09:00 +0800] "GET
 /hello.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.0" 200 2146
4月 102013
 

安装必要条件

为Horde Groupware编译受支持的PHP5.3.22运行环境

# yum install openssl-devel libpng-devel \
libjpeg-devel libicu-devel libtidy-devel \
libc-client-devel \
autoconf ImageMagick-devel libssh2-devel

配置并编译PHP

 ./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql \
--with-libxml-dir=/usr/local/libxml2 \

--enable-mbstring \
--with-kerberos --with-imap-ssl \
--with-imap=/usr/local/dovecot/include/dovecot/ \

--with-gettext --with-tidy \
--with-gd --with-png-dir --with-jpeg-dir \
--with-openssl --enable-intl \

--enable-ftp --with-zlib \

错误分析–enable-intl

checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU
 install prefix and make sure icu-config works.

#yum install libicu-devel

错误分析 –with-tidy

checking for TIDY support... yes
configure: error: Cannot find libtidy

# yum install libtidy-devel

 

Horde建议安装的PHP Extension Community Library

错误分析 pecl install

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

# yum install autoconf

安装imagick

# pecl install imagick

安装成功并在配置文件中添加PHP扩展

install ok: channel://pecl.php.net/imagick-3.0.1
configuration option “php_ini” is not set to php.ini location
You should add “extension=imagick.so” to php.ini

horde-groupware-504-01

错误分析 pecl install imagick

checking ImageMagick MagickWand API configuration program... 
configure: error: not found. Please provide a path to
 MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure --with-imagick' failed

# yum install ImageMagick-devel

安装lzf

horde-groupware-504-02 horde-groupware-504-03

安装memcache

horde-groupware-504-04

horde-groupware-504-05

使用PEAR在线安装horde groupware

1

[root@localhost ~]# pear channel-discover pear.horde.org
Adding Channel "pear.horde.org" succeeded
Discovery of channel "pear.horde.org" succeeded
[root@localhost ~]#

2

[root@localhost ~]# pear install horde/horde_role
downloading Horde_Role-1.0.1.tgz ...
Starting to download Horde_Role-1.0.1.tgz (10,977 bytes)
.....done: 10,977 bytes
install ok: channel://pear.horde.org/Horde_Role-1.0.1
horde/Horde_Role has post-install scripts:
/usr/share/pear/PEAR/Installer/Role/Horde/Role.php
Horde_Role: Use "pear run-scripts horde/Horde_Role" to finish setup.
DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES
[root@localhost ~]#

3

[root@localhost ~]# pear run-scripts horde/Horde_Role
Including external post-installation script "/usr/local/php/lib/php/PEAR
/Installer/Role/Horde/Role.php" - any errors are in this script
Inclusion succeeded
running post-install script "Horde_Role_postinstall->init()"
init succeeded
Filesystem location for the base Horde application : /usr/local/apache/htdocs
Configuration successfully saved to PEAR config.
Install scripts complete
[root@localhost ~]#

4

# pear install horde/webmail

安装成功

install ok: channel://pear.horde.org/Horde_Crypt-2.1.3
install ok: channel://pear.horde.org/Horde_Notification-2.0.1
install ok: channel://pear.horde.org/Horde_Core-2.4.3
install ok: channel://pear.horde.org/content-2.0.2
install ok: channel://pear.horde.org/timeobjects-2.0.3
install ok: channel://pear.horde.org/Horde_Form-2.0.3
install ok: channel://pear.horde.org/Horde_Rpc-2.0.3
install ok: channel://pear.horde.org/horde-5.0.4
install ok: channel://pear.horde.org/imp-6.0.4
install ok: channel://pear.horde.org/ingo-3.0.3
install ok: channel://pear.horde.org/kronolith-4.0.4
install ok: channel://pear.horde.org/mnemo-4.0.3
install ok: channel://pear.horde.org/nag-4.0.2
install ok: channel://pear.horde.org/turba-4.0.3
install ok: channel://pear.horde.org/webmail-5.0.4

查看文件

horde-groupware-504-06

为HORDE GROUPWARE 5.0.4创建数据并授权

mysql> create database groupware;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on groupware.* to groupware;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on groupware.* to groupware@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for groupware@localhost=password(‘gwpasswd’);
Query OK, 0 rows affected (0.00 sec)

 

[root@localhost ~]# pear config-get bin_dir
/usr/local/php/bin

horde-groupware-504-07

 

horde-groupware-504-08

horde-groupware-504-09

 

horde-groupware-504-10

修改配置文件启用测试页面

[root@localhost ~]# vi /usr/local/apache/htdocs/config/conf.php
$conf['testdisable'] = false;

horde-groupware-504-11

修改Webmail目录及文件所有者为apache用户和组

[root@localhost ~]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# chown -R apache.apache .

……

horde-groupware-504-12

[root@localhost ~]# pear install HTTP_WebDAV_Server
Failed to download pear/HTTP_WebDAV_Server within preferred state “stable”, latest release is version 1.0.0RC8, stability “beta”, use “channel://pear.php.net/HTTP_WebDAV_Server-1.0.0RC8” to install
install failed
[root@localhost ~]# pear install channel://pear.php.net/HTTP_WebDAV_Server-1.0.0RC8
downloading HTTP_WebDAV_Server-1.0.0RC8.tar …
Starting to download HTTP_WebDAV_Server-1.0.0RC8.tar (Unknown size)
…………………………….done: 159,744 bytes
install ok: channel://pear.php.net/HTTP_WebDAV_Server-1.0.0RC8
[root@localhost ~]#

horde-groupware-504-13

[root@localhost ~]# pear install Net_SMTP
WARNING: “pear/Auth_SASL” is deprecated in favor of “pear/Auth_SASL2”
downloading Net_SMTP-1.6.1.tar …
Starting to download Net_SMTP-1.6.1.tar (Unknown size)
…………….done: 65,024 bytes
install ok: channel://pear.php.net/Net_SMTP-1.6.1
[root@localhost ~]#

horde-groupware-504-14

[root@localhost ~]# pear install XML_Serializer
Failed to download pear/XML_Serializer within preferred state “stable”, latest release is version 0.20.2, stability “beta”, use “channel://pear.php.net/XML_Serializer-0.20.2” to install
install failed
[root@localhost ~]# pear install channel://pear.php.net/XML_Serializer-0.20.2
WARNING: “pear/XML_Parser” is deprecated in favor of “pear/XML_Parser2”
downloading XML_Serializer-0.20.2.tar …
Starting to download XML_Serializer-0.20.2.tar (Unknown size)
…………………………………………………done: 273,408 bytes
downloading XML_Parser-1.3.4.tar …
Starting to download XML_Parser-1.3.4.tar (Unknown size)
…done: 90,624 bytes
install ok: channel://pear.php.net/XML_Parser-1.3.4
install ok: channel://pear.php.net/XML_Serializer-0.20.2
[root@localhost ~]#

horde-groupware-504-15

配置IMP邮件服务器端参数

[root@localhost ~]# cd /usr/local/apache/htdocs/imp/config/
[root@localhost config]# cp backends.php backends.local.php
[root@localhost config]# vi backends.local.php

登录

horde-groupware-504-16

horde-groupware-504-17

 

horde-groupware-504-18

关闭测试页面

horde-groupware-504-19

错误分析

# cat /usr/local/apache/logs/error_log
[Wed Apr 10 02:16:46 2013] [error] [client 192.168.1.151] PHP Warning:  phpinfo() [<a href=’function.phpinfo’>function.phpinfo</a>]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing’ for ‘CST/8.0/no DST’ instead in /usr/local/apache/htdocs/php.php on line 1

修改php.ini时区设置

# vi /usr/local/php/lib/php.ini
date.timezone = Asia/Chongqing

3月 302013
 

为Horde Webmail 1.2.11编译的PHP 5.2.17环境配置

horde-webmail-03

ss

horde-webmail-04

 

horde-webmail-05

修改Horde日志文件路径

horde-webmail-06

错误分析1 登录webmail页面反应缓慢且产生错误日志信息

Apr 08 13:54:18 HORDE [warning] [imp] Could not complete request. 
Reason Given: [AUTHENTICATIONFAILED] Authentication 
failed.: NO [pid 12547 on line 384 of "/usr/local/horde/imp/lib/IMAP/Client.php"]

修改dovecot验证方法配置

# vi /usr/local/dovecot/etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = plain login

错误分析2 通过Horde Webmail发送邮件失败

horde-webmail-07

发送邮件失败时的Horde错误日志

Apr 01 11:27:25 HORDE [error] [imp] sendmail returned error code 127 
[pid 23321 on line 754 of "/usr/local/horde/imp/lib/Compose.php"]

发送邮件失败时的Apache错误日志

sh: /usr/lib/sendmail: 没有那个文件或目录

解决方法

[root@mail ~]# cd /usr/lib/
[root@mail lib]# ln -s /usr/sbin/sendmail sendmail

相关下载:(1) Horde Webmail 1.2.11

3月 142013
 

安装Apache服务

安装perl(编译apache模块依赖)

[root@mail httpd-2.2.24]# yum install perl

添加用户

[root@mail httpd-2.2.24]# groupadd -r apache 
[root@mail httpd-2.2.24]# useradd -r -M -g apache apache

编译安装

[root@mail httpd-2.2.24]# ./configure --prefix=/usr/local/apache \
 > --enable-so --enable-rewrite 
[root@mail httpd-2.2.24]# make 
[root@mail httpd-2.2.24]# make install

Continue reading »

2月 212013
 

安装编译工具

[root@localhost ~]# yum install gcc make

添加用以执行nginx的用户

[root@localhost conf]# groupadd nginx
[root@localhost conf]# useradd -g nginx nginx -s /sbin/nologin

安装PHP依赖

[root@localhost php-5.2.17]# yum install libxml2-devel

CentOS 6.3最小化安装环境已包含libxml2未包含libxml2-devel

libxml2-devel的安装依赖包关系

Installing:
 libxml2-devel        i686        2.7.6-12.el6_4.1         updates        1.1 M
Installing for dependencies:
 pkgconfig            i686        1:0.23-9.1.el6           base            67 k
 zlib-devel           i686        1.2.3-29.el6             base            44 k
Updating for dependencies:
 libxml2              i686        2.7.6-12.el6_4.1         updates        800 k
 zlib                 i686        1.2.3-29.el6             base            73 k

编译安装PHP环境

[root@localhost php-5.2.17]# ./configure --prefix=/usr/local/php --enable-fastcgi
[root@localhost php-5.2.17]# make
[root@localhost php-5.2.17]# make install

将路径加入系统环境变量

[root@localhost ~]# vi /etc/profile
 export PATH=/usr/local/php/bin:$PATH
[root@localhost ~]# source /etc/profile
[root@localhost php-5.2.17]# cp php.ini-dist /usr/local/php/lib/php.ini

启动php-cgi模式,监听端口9000,并使用指定的php.ini配置,后台运行

[root@localhost ~]# php-cgi -b 9000 -c /usr/local/php/lib/php.ini &

查看php-cgi监听端口

[root@localhost ~]# netstat -ltun |grep 9000
 tcp        0      0 0.0.0.0:9000                0.0.0.0:*                   LISTEN
 [root@localhost ~]#

安装nginx编译过程中所需要的依赖软件包

[root@localhost nginx-1.4.0]# yum install gcc-c++ perl

编译安装nginx 1.4.0版本

[root@localhost nginx-1.4.0]# ./configure --prefix=/usr/local/nginx \
 > --with-http_stub_status_module --with-http_ssl_module \
 > --with-pcre=../pcre-8.32/ --with-zlib=../zlib-1.2.8 \
 > --with-openssl=../openssl-1.0.1e
[root@localhost nginx-1.4.0]# make
[root@localhost nginx-1.4.0]# make install

将nginx加入系统环境变量

export PATH=/usr/local/nginx/sbin:$PATH

查看nginx版本

[root@localhost ~]# nginx -v
 nginx version: nginx/1.4.0
 [root@localhost ~]#

默认示例配置文件部分

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}

启用FastCGI并修改配置

location ~ \.php$ {
 root           html;
 fastcgi_pass   127.0.0.1:9000;
 fastcgi_index  index.php;
 #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name;
 include        fastcgi_params;
 }

建立PHP测试页面文件

[root@localhost ~]# cd /usr/local/nginx/html/
[root@localhost html]# vi hello.php
 <?php phpinfo(); ?>

启动nginx并查看端口监听状态

[root@localhost ~]# netstat -ltu |grep http
 tcp        0      0 *:http                      *:*                         LISTEN
[root@localhost ~]#

访问默认首页

nginx-php-01

 

访问PHP测试页面

…… nginx-php-02

相关下载:
(1) nginx 1.4.0 (2)(3)