fedora lamp配置

 

一、安装 apache

        tar -zxvf httpd-2.2.6.tar.gz

        cd httpd-2.2.6

        。/configure——prefix=/usr/local/lampapache——enable-module=so

        make

        make install

二.安装 php-5.2.4

        tar -zxvf php-5.2.4.tar.gz

        cd php-5.2.4

        。/configure——prefix=/usr/local/lampphp ——with-apxs2=/usr/local/lampapache2/bin/apxs
    ——with-config-file-path=/usr/local/lamplib——with-mysql

        make

        make install

        cp php.ini-dist /usr/local/lamplib/php.ini

        4.配置

        vi /usr/local/lampapache/conf/httpd.conf对apache做如下配置

        #ServerAdmin一行改为您的邮箱地址

        #DocumentRoot “/home/httpd/html/” 此处为html文件主目录

        #Options FollowSymLinks MultiViews为安全起见,去掉”Indexes”

        # DirectoryIndex default.php default.phtml default.php3 default.html
    default.htm

        #

        # 设置apache的默认文件名次序

        #AddType application/x-httpd-php .php .phtml .php3 .inc

        #AddType application/x-httpd-php-source .phps

        # 设置php 文件后缀

        存盘退出

        vi /usr/local/lamplib/php.ini

        #register-golbals = On

        存盘退出

        5.启动apache

        /usr/local/lampapache2/bin/apachectl start

        如果提示一下错误:

        Can not load /usr/local/lampapache2/modules/libphp5.so into server:

        /usr/local/lampapache2/modules/libphp5.so :

        Can’t restore segment prot after reloc: Permission denied

        Linux

        因为无法加载php 模块,在调试PHP 程序是提示下载php ,或者显示php 源
    代码,解决方法:

        修改 httpd.conf

        LoadModule php5_module modules/libphp5.so

        AddType application/x-httpd-php .php

        执行:chcon /usr/local/lampapache2/modules/libphp5.so -t shlib_t(重要:否则提示’/usr/local/lamplamp/apache2/bin/apachectl’ stop
httpd: Syntax error on line 103 of /usr/local/lamplamp/apache2/conf/httpd.conf: Cannot load /usr/local/lamplamp/apache2/modules/libphp5.so into server: /usr/local/lamplamp/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied)

        注销系统重新进入

        /usr/local/lampapache2/bin/apachectl start

 

三、安装mysql

tar zxvf mysql 5.0

mv mysql 5.0 /usr/local/lamp/mysql

cd /usr/local/lamp/mysql

groupadd mysql

adduser -g mysql mysql

chown -R mysql ./

chgrp -R mysql ./

cd   ./support-files/my-medium.cnf /etc/my.cnf #选择服务器的用途

./configure –prefix=/usr/local/lamp/mysql

然后初始化数据库

scripts/mysql_install_db –user=root

启动./bin/mysqld_safe –user=yernsun