freebsd php mysql_用FreeBsd+apache+mysql+php配置LAMP

首先说一下我的感受。

第一次配置时最好在虚拟机里面进行配置,可能第一次配置不会成功,在下载下面用到的这些软件时最好不要用最新的版本,不过mysql可以使用最新的版本,其他的软件我会上传到群共享里

面去(mysql除外,mysql太大了),大家可以去群共享去下载

另外,配置LAMP需要有耐心、一定要有耐心、特别要有耐心、非常地特别地有耐心。

配置过程中需要自己记住软件安装在哪个文件夹下面的,在最后安装php的时候会用的。

我这里用的freebsd系统(unix)应该适用其他Linux,本次配置采用编译安装,非ports安装,yum安装什么的。这样安装的好处是可以定制属于自己的服务器。

我的服务器里面没有安装freetype这个软件,听说是什么字体的,我装了一下,没装上去,希望有人能装上,装上了告诉我一下。

好了废话不多说,下面来教程

最好严格按照此顺序进行安装,不然出了问题我不负责哦。

软件上传在Yii Framework ①群中名称为:LAMP.part1.rar~LAMP.part5.rar,共5个包。

本教程中有列举安装过程出现的部分错误,供大家进行参考。

mysql安装

mysql安装来自于mysql官网,大家可以去参考一下:http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html

注:mysql建议解压在/usr/local下面,因为mysql是解压之后就是可以用的,所以不用进行编译安装,

只需要少量的操作即可。

shell> pw groupadd mysql

shell> pw useradd mysql -g mysql

shell> cd /usr/local

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> scripts/mysql_install_db --user=mysql

shell> chown -R root .

shell> chown -R mysql data

Next command is optional

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> bin/mysqld_safe --user=mysql &

Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

**Mysql配置**

拷贝管理脚本

Cd /usr/local/mysql/bin

Cp mysql /usr/sbin

Cp mysqladmin /usr/sbin

Cp mysqld_safe /usr/sbin

Rehash

拷贝配置文件

Cd /usr/local/mysql/share/mysql

Cp my-huge.cnf /usr/local/etc/my.cnf

注:my-huge.cnf在mysql/support-files下面

启动与停止

Mysqld_safe &

Mysqladmin shutdown

设定自启动

cp mysql.server /usr/local/etc/rc.d/mysql.server.sh

注:rc.d目录需要自行创建,并赋予777的权限

chmod 777 mysql.server.sh

/bin/sh /etc/rc \ 验证是否可以自启动

Starting sshd.

Starting cron.

Local package initialization:/usr/local/etc/rc.d/httpd.sh start: httpd (pid 9600) already running

Starting MySQL SUCCESS! \ 显示成功

Sql代码 复制代码

1. GRANT ALL PRIVILEGES ON . TO 'myuser'@'%' IDENTIFIED BY 'mypassword';

3. FLUSH PRIVILEGES;

httpd安装

./configure --enable-so --enable-track-vars --enable-moudules-most

make

make install

******httpd设置自启动********

ee /usr/local/etc/rc.d/apache.sh

添加如下内容:

/usr/local/apache/bin/apachectl start &

按esc键保存后退出,并执行如下命令:

chmod 777 apache.sh

Perl5 安装

./Configure -des -Dprefix=/usr/local/perl

make test

make install

Once you have Perl installed, a wealth of documentation is available to you

through the 'perldoc' tool. To get started, run this command:

perldoc perl

libxml2.6.11 安装

./configure && make && make install

libpng安装

./configure && make && make install

libiconv1.13.1 安装

./configure --prefix=/usr/local/libiconv113

make

make install

libjpeg 安装

mkdir /usr/local/modules

mkdir /usr/local/jpeg6

mkdir /usr/local/jpeg6/bin

mkdir /usr/local/jpeg6/lib

mkdir /usr/local/jpeg6/include

mkdir /usr/local/jpeg6/man

mkdir /usr/local/jpeg6/man/man1

tar -xzvf jpegsrc.v6b.tar.gz

cd jpeg6

./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static

make

make install

gd库安装

./configure --with-jpeg=/usr/local/jpeg6 --with-libiconv-prefix=/usr/local/include --with-png --with-zlib --with-xpm

出现找不到jpeglib.h错误时

cp /usr/local/jpeg/include/* /usr/include/

即可解决

出现找不到png.h或gd_png.c:xxx: error错误时

需要修改/usr/local/gd2/src/gd_png.c

将#include "png.h"

改为#include "/usr/local/include/png.h"

缺省情况下,GD库编译时并不加入JPEG支持,得修改Makefile文件。修改Makefile文件,使得:

CFLAGS=-O -DHAVE_XPM -DHAVE_JPEG -DHAVE_LIBTTF

LIBS=-lm -lgd -lpng -lz -ljpeg -lttf -lXpm -lX11

php编译

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/include/libxml --with-iconv=/usr/local/libiconv113 --with-zlib --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir --enable-ftp --enable-sockets --with-gd=/usr/local --enable-gd-native-ttf --with-ttf --enable-magic-quotes --enable-mbstring --with-config-file-path=/usr/local/php5/etc

如果编译时出现后面的错误! Sorry, I cannot run apxs,则需要找到apxs文件,并进行编辑,

将:#!/replace/with/path/to/perl/interpreter -w 更改为:#!/usr/bin/perl -w

配置httpd.conf

一般在/usr/local/apache2/conf文件夹下面

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

在httpd.conf中增加

AddType application/x-httpd-php .php .php4 .php3

修改:

DirectoryIndex index.html

改成:DirectoryIndex index.html index.php

出现如下错误

No such file or directory: Failed to enable the 'httpready' Accept Filter

解决方法:

直接在shell里面输入:

kldload accf_http

再输入启动语句即可

并将/boot/defaults/loader.conf中,以便下次启动自动装载模块

accf_data_load="YES"

accf_http_load="YES"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值