骏马金龙 (新博客:www.junmajinlong.com)

网名骏马金龙,钟情于IT世界里的各种原理和实现机制,强迫症重症患者。爱研究、爱翻译、爱分享。特借此一亩三分田记录自己成长点滴!!!

搭建LAMP环境示例

apache httpd系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html


本文给出搭建LAMP的步骤,其中php使用的是php-fpm管理方式,php和MySQL(MariaDB)交互使用的是mysqlnd方式(另一种是libmysql)。最后给出一个php+mysql的论坛程序discuz的布置过程。

1. 编译apache httpd

此处只简单给出编译httpd的步骤,具体的编译细节知识点见编译httpd细节

httpd相关资源下载地址:http://archive.apache.org/dist/

安装依赖包。

yum -y install pcre pcre-devel expat-devel

编译apr和apr-util。

tar xf apr-1.6.2.tar.gz
tar xf arp-1.6.0.tar.gz
cd apr-1.6.0
./configure --prefix=/usr/local/apr 
make
make install
cd ../apr-util-1.6.2
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install

编译httpd。

tar xf httpd-2.4.27.tar.gz
cd httpd-2.4.27
./configure --prefix=/usr/local/apache --sysconfdir=/etc/apache --with-z --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-mpm=event --enable-mpms-shared=all

编译后的规范化操作:

# 设置man路径。
echo "MANPATH /usr/local/apache/man" >>/etc/man.config

# 设置PATH环境变量。
echo 'PATH=/usr/local/apache/bin:$PATH' >/etc/profile.d/apache.sh
source /etc/profile.d/apache.sh

# 输出头文件。
ln -s /usr/include /usr/local/apache/include

提供服务启动脚本:

提供不提供没多大所谓,因为apachectl或httpd命令自身可以管理进程的启停,但自身管理启停时不提供lock文件。

如果要提供的话,从yum安装的httpd提供的/usr/lib/systemd/system/httpd.service(systemd)或/etc/init.d/httpd(sysV)拷贝后稍作修改就可以了。以下是按照我上面编译的环境做了修改后的systemd和sysV服务管理脚本。

以下是httpd的systemd服务管理脚本/usr/lib/systemd/system/httpd.service。

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/local/apache/bin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/local/apache/bin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target

以下是httpd的sysV服务管理脚本/etc/rc.d/init.d/httpd。

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible  \
#           server implementing the current HTTP standards.
#
######################################################################
#  若httpd配置文件中指定了PidFile,则修改此脚本中的pidfile变量           #
######################################################################

. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=/usr/local/apache/bin/apachectl
prog=httpd
pidfile=/usr/local/apache/logs/httpd.pid
lockfile=/var/lock/subsys/httpd
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
config=/etc/apache/httpd.conf

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd -f $config $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
    status -p ${pidfile} $httpd > /dev/null
    if [[ $? = 0 ]]; then
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
    else
        echo -n $"Stopping $prog: "
        success
    fi
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=6
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        # Force LSB behaviour from killproc
        LSB=1 killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
        if [ $RETVAL -eq 7 ]; then
            failure $"httpd shutdown"
        fi
    fi
    echo
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
        status -p ${pidfile} $httpd
    RETVAL=$?
    ;;
  restart)
    stop
    start
    ;;
  condrestart|try-restart)
    if status -p ${pidfile} $httpd >&/dev/null; then
        stop
        start
    fi
    ;;
  force-reload|reload)
        reload
    ;;
  graceful|help|configtest|fullstatus)
    $apachectl $@
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
    RETVAL=2
esac

exit $RETVAL

最后启动httpd。

service httpd start

2. 编译php

三种工作模式:CGI、作为模块加入到apache、fastcgi。最简单的是以模块方式加入到apache,此处演示的是php-fpm管理php-cgi方式。其他两种方式见php-cgi和httpd交互的方式

fastcgi模式的php-cgi,由php-fpm提供服务管理,它会根据配置文件启动一定数量的cgi进程,其默认监听的端口为9000,该服务正常工作需要配置文件。也就是说fastcgi模式的php有两个配置文件,一个是php的配置文件,一个是php-fpm的配置文件。

虽然此处演示的是php-fpm管理方式,但有必要说明下,在Linux中如果模块化安装php,不推荐在使用Apache 2.x中使用线程化MPM(worker和event),而是使用prefork模式的mpm,因为Linux系统的线程设计并不那么完美。所以,如果php和apache在同一台主机上(cgi或者模块化方式安装php的时候),建议httpd使用prefork模型,而不在同一台主机中,建议将php设计为fastcgi的工作模式。而在windows平台中则无需考虑这些问题,因为windows系统是真正意义上的多线程系统。

下载相关文件:
php下载地址:http://php.net/downloads
php手册地址:http://php.net/manual/zh/
手册下载地址:http://php.net/download-docs.php

2.1 php编译选项说明

编译安装php有非常非常多的选项,比httpd还多。可以在解压php后的目录下使用./configure --help查看。以下是部分选项,其中给出"--enable-XXXX"的选项表示默认是disable的,若要开启,需要在此处手动enable,如果给出的是"--disable-XXXX"表示默认是enable的。

--prefix=PREFIX
【SAPI modules:】
--with-apxs2=FILE       Build shared Apache 2.0 Handler module. FILE is the optional
                          pathname to the Apache apxs tool apxs
--enable-fpm            Enable building of the fpm SAPI executable

【General settings:】
--with-config-file-path=PATH      Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH  Set the path where to scan for configuration files

【Extensions:】
      #######################################################
      # --with-EXTENSION=shared[,PATH]                      #
      # NOTE: Not all extensions can be build as 'shared'.  #
      # Example: --with-foobar=shared,/usr/local/foobar/    #
      #######################################################
--with-openssl=DIR      Include OpenSSL support (requires OpenSSL >= 0.9.6)
--enable-mbstring       Enable multibyte string support
--with-zlib=DIR         Include ZLIB support
--with-bz2=DIR          Include BZip2 support
--with-mhash=DIR        Include mhash support
--with-mcrypt=DIR       Include mcrypt support
--with-freetype-dir=DIR  GD: Set the path to FreeType 2 install prefix
--with-jpeg-dir=DIR     GD: Set the path to libjpeg install prefix
--with-png-dir=DIR      GD: Set the path to libpng install prefix
--with-libxml-dir=DIR   SimpleXML: libxml2 install prefix
--enable-sockets        Enable sockets support
--disable-xml           Disable XML support (不写时默认--enable-xml)

【连接数据库:】
--with-mysql=DIR        Include MySQL support.  DIR is the MySQL base
                          directory, if no DIR is passed or the value is
                          mysqlnd the MySQL native driver will be used
--with-mysqli=FILE      Include MySQLi support.  FILE is the path
                          to mysql_config.  If no value or mysqlnd is passed
                          as FILE, the MySQL native driver will be used
--with-pdo-mysql=DIR    PDO: MySQL support. DIR is the MySQL base directory
                          If no value or mysqlnd is passed as DIR, the
                          MySQL native driver will be used
--enable-mysqlnd        Enable mysqlnd explicitly, will be done implicitly
                          when required by other extensions
【Zend:】
--enable-maintainer-zts    Enable thread safety - for code maintainers only!!

部分选项说明:

  1. 在【zend】扩展部分的选项"--enable-maintainer-zts"是为了让php支持多线程MPM的,即php以模块化方式或cgi模式安装时且httpd配置为worker或event时需要启用该项。而如果php以fastcgi模式安装时,由于php有独立的服务和进程,所以该项是多余的。
  2. "--with-apxs2"是让php以模块化的方式安装到其他程序中,"--enable-fpm"是让php以fastcgi模式工作的选项。所以此处采用后者,而以模块方式和httpd交互时采用前者。
  3. "--with-config-file-path"和"--with-config-file-scan-dir"分别是php配置文件php.ini的存放位置以及其他加载的配置文件路径,scan-dir类的目录就像/etc/profile.d、/etc/httpd/conf.d这样的目录路径。
  4. "--with-openssl"选项让php支持ssl;"--enable-mbstring"选项是让php支持多字节字符的,例如中文一个字符两个字节,也就是说让php支持国际化的;"--with-zlib"、"--with-bz2"、"--with-mhash"和"--with-mcrypt"选项让php支持这些压缩和加密机制。
  5. "--with-freetype-dir"、"--with-jpeg-dir"和"--with-png-dir"分别是让php支持多种文字样式、支持jpeg、支持png的选项。
  6. php连接mysql有两种方式,一种是以libmysql的驱动方式连接mysql,一种是以mysqlnd方式驱动连接mysql。以下列出了libmysql和mysqlnd这两种驱动方式的编译模式。
    • (1).以libmysql驱动方式连接mysql(Mariadb),需要提前安装mysql(Mariadb)和mysql-devel(mariadb-devel),并使用"--with-mysql"选项指定mysql安装路径,"--with-mysqli"选项指定mysql_config脚本的路径,"--with-pdo-mysql"选项也指定mysql安装路径。假如mysql安装在/usr/local/mysql下。
      ./configure --prefix=/usr/local/php \
      --with-mysql=/usr/local/mysql \
      --with-mysqli=/usr/local/mysql/bin/mysql_config
      
    • (2).以mysqlnd驱动方式连接mysql,不需要提前安装mysql和mysql-devel,--with-mysql、--with-mysqli和--with-pdo-mysql选项都不需要指定具体路径,只需使用mysqlnd作为这些选项的值即可。
      ./configure --prefix=/usr/local/php \
      --with-mysql=mysqlnd \
      --with-mysqli=mysqlnd \
      --with-pdo-mysql=mysqlnd
      
      在php 5.3的时候已经支持mysqlnd驱动方式了,在php 5.4的时候mysqlnd已经是默认的配置选项了。建议使用mysqlnd的驱动方式。

2.2 php编译过程

由于是配置fastcgi的模式,所以在./configure的时候将apxs2功能换为"--enable-fpm",并且由于此模式下的php由自己独立的服务来控制进程的生成,所以对于为了支持httpd线程的选项"--enable-maintainer-zts"也去掉。以下是编译安装过程:

yum install -y bzip2-level libmcrypt-devel openssl-devel libxml2-devel

tar xf php-5.5.38.tar.bz2 -C /tmp
cd /tmp/php-5.5.38
./configure --prefix=/usr/local/php --with-openssl --enable-mbstring --enable-sockets --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir=/usr --enable-xml --with-zlib --with-mcrypt --with-bz2 --with-mhash --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm

make
make install
# 提供php配置文件
cp php.ini-production /etc/php.ini

# 提供php-fpm服务管理脚本
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmd
chmod +x /etc/init.d/php-fpmd

# 提供php-fpm配置文件
cd /usr/local/php/
cp etc/php-fpm.conf.default etc/php-fpm.conf

# 修改php-fpm配置文件(做实验的话改不改随意)
vim etc/php-fpm.conf
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8

# 启动php-fpm
service php-fpmd start

2.3 配置httpd使其转发动态请求给php-fpm

# 启用fcgi的支持模块。
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

# 添加php后缀格式文件的识别功能。
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

# 添加php后缀的主页
DirectoryIndex index.php index.html

# 启用虚拟主机模块,Include虚拟主机配置文件,并注释中心主机DocumentRoot。
#DocumentRoot "/usr/local/apache/htdocs"
Include /etc/apache/extra/httpd-vhosts.conf

# 配置虚拟主机。注意主机中需要添加下面两行,第一行表示关闭正向代理功能,第二行表示反向代理时进行正则匹配。
# 对主机的.php(不区分大小写)文件的访问都通过fcgi协议交给php,由于此处测试,php正好和httpd在同一服务器上,# 且php-fpm默认监听的端口为9000,所以为fcgi://127.0.0.1:9000,在此之后还需要写上/DocumentRoot/$1,
# "$1"是正则的反向引用
ProxyRequests off
ProxyPassMatch "(?i)^/(.*\.php)$" fcgi://127.0.0.1:9000/var/www/a.com/$1

提供主页测试文件index.php。

mkdir -p /var/www/a.com

vim /var/www/a.com/index.php
<h1>a.com</h1>
<?php
    phpinfo();
?>

重启httpd,浏览器中进行站点访问测试。

3. 为php安装xcache

php是一种解释型语言,意味着php脚本在执行时不需要事先编译,而是像shell脚本一样直接执行。但事实上它还是会编译的,只不过是执行时"偷偷地"编译,它会将代码编译成字节码(opcode)然后运行。编译是一个很消耗时间的操作,因此需要为编译好的opcode提供缓存以提高性能,降低负载。目前最流行的opcode缓存工具是XCache,它是一个开源的工具。

下载路径:http://xcache.lighttpd.net/pub/Releases/

3.1 基本安装

安装xcache。

tar xf xcache-3.2.0.tar.bz2 -C /tmp
cd /tmp/xcache-3.2.0/

# 添加扩展前,先运行phpize
/usr/local/php/bin/phpize
./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-cofig
make && make install

在安装完成之后有一行,这一行很重要,因为这个路径要添加到配置文件中。

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20121212/

在解压xcache的目录下,有xcache的配置文件xcache.ini,将其追加到php的配置文件中,或者将其复制到php的配置文件扫描目录/etc/php.d下(该目录是之前编译php时./configure配置选项"--with-config-file-scan-dir"指定的项)。

mkdir /etc/php.d
cp xcache.ini /etc/php.d/
vim /etc/php.d/xcache.ini

在该文件中加上一行,该行必须在该文件中的所有extension指令的最前面。

zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20121212/xcache.so

其实对于xcache 3.0版本和以后版本,可以不用复制xcache模块的路径到配置文件中,因为可以自动找到php路径下的模块路径,甚至添加了可能还会出错。

3.2 设置管理员后台

设置了管理员后台,管理员可以查看xcache相关的信息和加速的情况。做法很简单。修改配置文件中的xcache.admin.user和xcache.admin.pass两项,分别为管理员账号和密码。注意该密码只能是md5加密的密码。

例如,user设置为Admin,密码为"123456":

[root@toystory xcache-3.2.0]# echo "123456" | md5sum
e10adc3949ba59abbe56e057f20f883e  -
[root@toystory xcache-3.2.0]# vim /etc/phd.d/xcache.ini
xcache.admin.user = "Admin"
xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e"

保存退出。复制xcache解压路径下的htdocs目录(有些版本的xcache是admin目录)到httpd的DocumentRoot下。

cp -a htdocs /usr/local/apache/htdocs/

然后重启httpd,在浏览器中输入http://IP/htdocs,会弹出xcache的管理员验证,输入用户名Admin和密码123456,即可查看管理员页面。

4. 安装MySQL(MariaDB)

此处以MySQL通用二进制包安装为例,它相当于windows中的便携版软件,解压后稍微配置下进行初始化就可以直接使用,不用安装。其他方法、安装细节、多实例以及MariaDB等见mysql & mariadb安装细节

mysql通用二进制版官方下载地址:

MySQL 5.6通用二进制包下载: https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35-linux-glibc2.12-x86_64.tar.gz

MySQL 5.7通用二进制包下载: https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.12-x86_64.tar.gz

其中文件中的glibc2.12表示的是Linux系统的glibc版本要比2.12新,可以使用ldd --version查看glibc版本。在CentOS 6上glibc默认就是2.12的,所以无需顾虑。

shell> tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
shell> ln -s /usr/local/mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql

4.1 初始化实例

初始化前先进行一些配置。

shell> mkdir -p /mydata/data   # 作为数据目录datadir
shell> useradd -r -s /sbin/nologin mysql
shell> chown -R mysql.mysql /usr/local/mysql
shell> chown -R mysql.mysql /mydata/data
shell> cd /usr/local/mysql
shell> scripts/mysql_install_db --datadir=/mydata/data --user=mysql
shell> chown -R root.root /usr/local/mysql

执行mysql_install_db初始化时会在/tmp下创建临时表,所以mysql用户需要对/tmp有写权限,否则执行实例初始化脚本时可能会报类似下面的错误:
ERROR: 1 Can't create/write to file '/tmp/#sql_7a0e_0.MYI' (Errcode: 13)
这说明没有写权限,所以需要修改/tmp目录的权限:

chmod 1777 /tmp

也可以使用下面的方法初始化,事实上mysql_install_db已经作为废弃的工具,在执行时很可能会提示该工具已废弃。

bin/mysqld --initialize-insecure --datadir=/mydata/data --user=mysql

初始化完成后,提供配置文件和服务启动脚本。

shell> cp -a support-files/mysql.server /etc/init.d/mysqld
shell> cp -a support-files/my-default.cnf /etc/my.cnf  

# 修改my.cnf的datadir
shell> vim /etc/my.cnf 
[mysqld]
datadir=/mydata/data

如果是centos7,则提供如下服务启动脚本(如有必要,修改pid文件路径)。

shell> cat /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

Type=forking

PIDFile=/var/run/mysqld/mysqld.pid

# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0

# Start main service
ExecStart=/usr/local/mysql-5.7.19/bin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS

# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql

# Sets open_files_limit
LimitNOFILE = 5000

Restart=on-failure

RestartPreventExitStatus=1

PrivateTmp=false

修改"root@localhost"密码。

shell> mysql
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> \q

4.2 安装后的规范化操作

编译安装或通用二进制安装后,一般都需要做一些额外的操作,包括设置环境变量、输出头文件和库文件、设置man路径。

echo "export PATH=/usr/local/mysql/bin:$PATH" >/etc/profile.d/mysql.sh
chmod +x /etc/profile.d/mysql.sh
source /etc/profile.d/mysql.sh
echo "MANPATH /usr/local/mysql/man" >>/etc/man.config

echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
ldconfig
ln -s /usr/local/mysql/include /usr/include/mysql

5. 测试LAMP——搭建discuz论坛

discuz是论坛软件系统,基于php+MySQL平台。基本配置很简单,更多的配置和个性化定制在官方主页查看教程。

官方主页:http://www.discuz.net/forum.php

discuz下载地址:http://www.discuz.net/thread-3570835-1-1.html

简单布置它们的过程很简单,只需复制相关文件到对应的网站根目录下,然后在浏览器中输入对应的目录名即可打开程序。中间测试过程中如果出现问题,再对应修改即可。

首先配置httpd,提供一个虚拟主机。

# 包含虚拟主机的配置文件,只需取消下面这行的注释符号"#"即可
#Include /etc/apache/extra/httpd-vhosts.conf

# 提供虚拟主机
vim /etc/apache/extra/httpd-vhosts.conf
<VirtualHost 192.168.100.61:80>
    DocumentRoot "/var/www/a.com/"
    ServerName www.a.com
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" combined
    <Directory "/var/www/a.com/">
        Options None
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

将解压后discuz中的upload目录复制到对应虚拟主机的DocumentRoot目录下。

cd Discuz
cp -a upload/ /var/www/a.com

重启httpd服务。测试discuz。不过得先在客户端的hosts文件中添加解析记录,例如此处为:

192.168.100.61 www.a.com。

在浏览器中输入http://www.a.com/upload即可。

然后在安装前会自动检查是否符合安装条件。将以下所有不符合条件的全部修改成符合条件。

cd /var/www/a.com/upload
touch config/config_{global,ucenter}.php
chmod a+w config/config_{global,ucenter}.php
chmod a+w  data config data/{cache,avatar,plugindata,download,addonmd5,template,threadcache,attachment,log} data/attachment/{album,forum,group}
chmod a+w uc_client/data/cache
chmod a+w uc_server/data uc_server/data/{cache,avatar,backup,logs,tmp,view}

刷新下,条件满足。

卸载的方法是删除upload目录,删除mysql中的discuz数据库。

如果乱码,则修改httpd的配置文件中的AddDefaultCharset指令。如:

AddDefaultCharset UTF-8

 

以上为LAMP相关的内容,布置过程稍显死板 ,作为实验示例,这也是没办法的事情。熟悉相关知识点之后,很容易就明白该如何搭建。

posted @ 2017-10-09 21:04  骏马金龙  阅读(2936)  评论(2编辑  收藏  举报