6 月 082019
 

主机清单

Jenkins (18.163.103.73/Hong Kong)
Gitlab (45.32.95.186/Los Angeles)
www (45.77.85.36/Los Angeles)
client (136.244.67.202/London)

为已完成的Jenkins安装必要插件

Locale
This plugin lets you control the language of Jenkins.

Publish Over SSH
Send build artifacts over SSH

修改语言设置(强制显示英语)

配置git路径

Jenkins > Global Tool Configuration > Git
Path to Git executable /usr/sbin/git

为PHP项目Wordpress准备LAMP运行环境

查看系统原生PHP及MySQL版本

[root@www ~]# yum info php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: repos-lax.psychz.net
 * extras: repos-lax.psychz.net
 * updates: repos-lax.psychz.net
Available Packages
Name        : php
Arch        : x86_64
Version     : 5.4.16
Release     : 46.1.el7_7
Size        : 1.4 M
Repo        : updates/7/x86_64
Summary     : PHP scripting language for creating dynamic web sites
URL         : http://www.php.net/
License     : PHP and Zend and BSD
Description : PHP is an HTML-embedded scripting language. PHP attempts to make
            : it easy for developers to write dynamically generated web pages.
            : PHP also offers built-in database integration for several
            : commercial and non-commercial database management systems, so
            : writing a database-enabled webpage with PHP is fairly simple. The
            : most common use of PHP coding is probably as a replacement for CGI
            : scripts.
            :
            : The php package contains the module (often referred to as mod_php)
            : which adds support for the PHP language to Apache HTTP Server.

[root@www ~]# yum info mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: repos-lax.psychz.net
 * extras: repos-lax.psychz.net
 * updates: repos-lax.psychz.net
Available Packages
Name        : mariadb-server
Arch        : x86_64
Epoch       : 1
Version     : 5.5.64
Release     : 1.el7
Size        : 11 M
Repo        : base/7/x86_64
Summary     : The MariaDB server and related files
URL         : http://mariadb.org
License     : GPLv2 with exceptions and LGPLv2 and BSD
Description : MariaDB is a multi-user, multi-threaded SQL database server. It is
            : a client/server implementation consisting of a server daemon
            : (mysqld) and many different client programs and libraries. This
            : package contains the MariaDB server and some accompanying files
            : and directories. MariaDB is a community developed branch of MySQL.

[root@www ~]#

配置PHP7.4 / MySQL 5.6环境

[root@www ~]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@www ~]# yum makecache

[root@www ~]# yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[root@www ~]# yum makecache

修改MySQL YUM仓库配置文件,启用MySQL5.6版本

[root@www ~]# vi /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[root@www ~]# yum makecache

执行环境安装

[root@www ~]# yum install httpd php74-php php74-php-pdo php74-php-pecl-mysql php74-php-gd mysql-community-server mysql-community-client

查看php版本信息

[root@www ~]# php74 -v
PHP 7.4.3 (cli) (built: Feb 18 2020 11:53:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
[root@www ~]#

启动Apache服务

[root@www ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@www ~]# systemctl start httpd
[root@www ~]#

准备测试文件

[root@www ~]# echo "<?php phpinfo(); ?>" > /var/www/html/hello.php
[root@www ~]# cat /var/www/html/hello.php 
<?php phpinfo(); ?>
[root@www ~]#

使用浏览器访问测试文件

为Jenkins服务器指向域名

C:\Users\harveymei>ping gitlab.bcoc.site

正在 Ping gitlab.bcoc.site [45.32.95.186] 具有 32 字节的数据:
来自 45.32.95.186 的回复: 字节=32 时间=335ms TTL=44
来自 45.32.95.186 的回复: 字节=32 时间=327ms TTL=44
来自 45.32.95.186 的回复: 字节=32 时间=335ms TTL=44
来自 45.32.95.186 的回复: 字节=32 时间=336ms TTL=44

45.32.95.186 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 327ms,最长 = 336ms,平均 = 333ms

C:\Users\harveymei>

添加YUM仓库

[root@gitlab ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

执行安装

[root@gitlab ~]# sudo EXTERNAL_URL="https://gitlab.bcoc.site" yum install -y gitlab-ce

提示安装成功

Thank you for installing GitLab!
GitLab should be available at https://gitlab.bcoc.site

使用浏览器访问

配置代码仓库

新建仓库

获取基于https的仓库地址

https://gitlab.bcoc.site/root/wordpress.git

在客户端主机生成密钥对

[root@client ~]# ssh-keygen -t ed25519 -C "harvey.mei@linuxcache.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/root/.ssh/id_ed25519):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_ed25519.
Your public key has been saved in /root/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:pBZks0rE/4PCRggJjT+QoBjE2k3fK+kh0mc98/HgOvA harvey.mei@linuxcache.com
The key's randomart image is:
+--[ED25519 256]--+
|O* .. +          |
|Oo..oo o         |
|+= +.oo..        |
|. =.o.o+.        |
|   =. o=S.       |
|  . *.O B o      |
|   o * = * +     |
|      . E o .    |
|        .o       |
+----[SHA256]-----+
[root@client ~]# cat .ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPqeQy7qZvEEcpf+R35DRMB8nXR2nmET049/QJ+z0Qm/ harvey.mei@linuxcache.com
[root@client ~]#

在gitlab用户账户设置中配置密钥

导入公钥详情

安装git命令行工具

[root@client ~]# yum -y install git

克隆远程仓库到本地

[root@client ~]# git config --global user.name "Harvey"
[root@client ~]# git config --global user.email "harvey.mei@linuxcache.com"
[root@client ~]# git clone git@gitlab.bcoc.site:root/wordpress.git
Cloning into 'wordpress'...
The authenticity of host 'gitlab.bcoc.site (45.32.95.186)' can't be established.
ECDSA key fingerprint is SHA256:vhmKGmm/onEV47Xe7T4QOr8t8hRfqoJS1sj3WN/T8oc.
ECDSA key fingerprint is MD5:6e:d7:f6:eb:1d:ff:f4:cf:c6:e7:70:da:36:32:ee:26.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.bcoc.site,45.32.95.186' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
[root@client ~]#

[root@client ~]# ls wordpress/
README.md
[root@client ~]#

下载Wordpress并解压至本地仓库目录

[root@client ~]# curl -O https://wordpress.org/latest.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.8M  100 11.8M    0     0  8362k      0  0:00:01  0:00:01 --:--:-- 8361k
[root@client ~]# tar xzf latest.tar.gz
[root@client ~]# ls wordpress/
index.php        wp-admin              wp-cron.php        wp-mail.php
license.txt      wp-blog-header.php    wp-includes        wp-settings.php
readme.html      wp-comments-post.php  wp-links-opml.php  wp-signup.php
README.md        wp-config-sample.php  wp-load.php        wp-trackback.php
wp-activate.php  wp-content            wp-login.php       xmlrpc.php
[root@client ~]#

推送源代码至gitlab仓库

[root@client ~]# cd wordpress/
[root@client wordpress]# git add .
[root@client wordpress]# git commit -m "Wordpress 5.3.2"
[root@client wordpress]# git push -u origin master
Counting objects: 2124, done.
Compressing objects: 100% (2085/2085), done.
Writing objects: 100% (2123/2123), 12.10 MiB | 4.41 MiB/s, done.
Total 2123 (delta 213), reused 0 (delta 0)
remote: Resolving deltas: 100% (213/213), done.
To git@gitlab.bcoc.site:root/wordpress.git
   73d3e3f..c52a7e6  master -> master
Branch master set up to track remote branch master from origin.
[root@client wordpress]#

在Gitlab查看已推送的代码

配置Jenkins自动化任务

添加目标服务器及配置信息
Jenkins > Manage Jenkins > Configure System > SSH Servers > Add

配置Jenkins访问Gitlab服务器的账户鉴权
Jenkins > Credentials > System > Global credentials(unrestricted) > Add Credentials

新建任务(自由风格项目)

配置Gitlab仓库信息
Jenkisn > PHP > Source Code Management > Git

配置构建信息
Jenkins > PHP > Build > Send files or execute commands over SSH

执行构建任务
Jenkins > PHP > Build Now

查看任务的控制台输出

控制台输出文本信息

Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/PHP
using credential 13e0e649-fa87-4a60-8021-85276d986544
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@gitlab.bcoc.site:root/wordpress.git # timeout=10
Fetching upstream changes from git@gitlab.bcoc.site:root/wordpress.git
> git --version # timeout=10
using GIT_SSH to set credentials Gitlab Account
> git fetch --tags --progress git@gitlab.bcoc.site:root/wordpress.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision c52a7e62f3676005177293d706c9d902ee807d99 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f c52a7e62f3676005177293d706c9d902ee807d99 # timeout=10
Commit message: "Wordpress 5.3.2"
First time build. Skipping changelog.
SSH: Connecting from host [ip-172-31-32-243.ap-east-1.compute.internal]
SSH: Connecting with configuration [www] ...
SSH: EXEC: STDOUT/STDERR from command [exit 0] ...
SSH: EXEC: completed after 400 ms
SSH: Disconnecting configuration [www] ...
SSH: Transferred 1931 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Finished: SUCCESS

查看www服务器/var/www/html目录下部署的项目代码

使用浏览器访问

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)