非root用户配置lamp环境(centos)

一、Apache源码安装过程

apache 安装过程中出现的问题:

http://code.sh/linux/apache%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%9Aapr-not-found/

1.解决apr not found问题——————>

可以用./configure –help | grep apr 查看帮助。

安装APR(Apache Portable Runtime )
下载:http://apr.apache.org/download.cgi  
   [root@yahoo test]# tar -zxf apr-1.4.5.tar.gz

   [root@yahoo apr-1.4.5]# ./configure --prefix=/usr/local/apr

   [root@yahoo apr-1.4.5]# make

   [root@yahoo apr-1.4.5]# make install

2.解决APR-util not found问题>>>>

下载:http://download.chinaunix.net/download/0001000/472.shtml

   [root@yahoo test]# tar -zxf apr-util-1.3.12.tar.gz

  [root@yahoo apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config

  [root@yahoo apr-util-1.3.12]# make
  [root@yahoo apr-util-1.3.12]# make install

3./mod_dir.so: undefined symbol: apr_array_clear不是没有mod_dir.so库,是库中没定义apr_array_clear
如果是源码包安装编译时加入--with-included-apr,将apr和apr-util放在httpd解压缩目录的srclib中;再试试;
如果apt-get安装的那整个系统搜索下,看是否系统中有多个mod_dir.so库,apache加载的不是预期的。

4.configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

#./configure –help | grep pcre
--with-pcre=PATH        Use external PCRE library

下载:http://sourceforge.net/projects/pcre

5.如何指定apache主配置文件httpd.conf的位置
编译安装时可以指定其配置文件安装路径./configure --sysconfdir=/etc/httpd

1、下载源文件解压,进入解压目录

2、./configure --prefix=/home/work/local/httpd --sysconfdir=/home/work/local/httpd –enable-so

3、make

4、make install

5、启动 apachect1 start’

非root用户无法启动80端口,所以需要修改http.conf文件,将主端口改为Listen 8888之类的

二、安装mysql (work)

http://dev.mysql.com/doc/refman/5.1/en/binary-installation.html  

dev.mysql.com/doc/
   下载mysql-5.1.x  (注mysql-5.5.x需要cmake安装)
   解压后,进入mysql-5.1.x目录:
./configure --prefix=/home/work/local/mysql5

   make && make install
   在/home/work/mysql5/下增加my.cnf配置文件,并修改配置
   然后:
cd /home/work/mysql5/bin
   ./mysql_install_db
   ./mysqld_safe &

三、安装php (work)
   1. 安装libxml2

http://www.linuxfromscratch.org/blfs/view/cvs/general/libxml2.html
   下载libxml2-sources-2.7.7.tar.gz后解压。make安装到/home/work/local/libxml2
   3. 安装php
   解压php-5.3.6.tar.bz2后进入目录
   /configure --prefix=/home/work/local/php \
--with-apxs2=/home/lidan3/local/httpd/bin/apxs \
--with-config-file-path=/home/lidan3/local/php/etc \
--with-mysql=/home/lidan3/local/mysql5 \
--with-libxml-dir=/home/lidan3/local/libxml2 \
--with-jpeg-dir \
--with-png-dir \
--with-bz2 \
--with-freetype-dir \
--with-iconv-dir \

    make && make install
    在http.conf中加入:
    AddType application/x-httpd-php .php
    同时在DirectoryIndex后面加上index.php
    重启apache:
cd /home/work/local/apache2/bin; ./apachectl -k restart

posted @ 2012-07-16 16:57  lidan  阅读(2021)  评论(0编辑  收藏  举报