`
netxdiy
  • 浏览: 736665 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

LAMP开发平台的搭建(openSUSE11.0 + Apache2.2 + PHP5.2 + MySQL5.1)

 
阅读更多

终于将LAMP搭建成功!终于在linux环境下将VirtualHost搭建成功!

心得:

1. 思考力比看书重要一千倍;

2. 世上的方法总是比问题多,所以学会使用google或者说学习力比看书重要。高效使用google应该成为搞技术的人最最基本的生存技能。靠着自己的头脑和网络学到的东西比上什么样的培训班都要有价值的多的多!

3. 遇到困难问题不要逃避,而是要高兴地勇敢地面对。能力就是在解决一个又一个问题后增强的,信心就是在搞定一个一个刺儿头后逐渐建立起来的。所以遇到难题要开心:给自个儿长能耐的机会来了!

linux下安装apache+php+mysql (2007-07-19 11:21:06)
标签:linux php 安装 文档 分类:网站建设

部分文件的下载地址,这些都是在安装php前需要安装的包

文件名称: gd-2.0.27.tar.gz
URL: http://www.boutell.com/gd/http/gd-2.0.27.tar.gz
引用页: http://jnet.cnblogs.com/articles/30789.html


文件名称: freetype-2.1.9.tar.gz
URL: http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz
引用页: http://jnet.cnblogs.com/articles/30789.html


文件名称: jpegsrc.v6b.tar.gz
URL: http://ijg.org/files/jpegsrc.v6b.tar.gz
引用页: http://jnet.cnblogs.com/articles/30789.html


文件名称: zlib-1.2.3.tar.gz下载地址:
http://www.zlib.net/


文件名称: libxml2-2.6.26.tar.gz下载地址:
ftp://xmlsoft.org/libxml2/libxml2-2.6.26.tar.gz


文件名称: libpng-1.2.16.tar.gz下载链接:
http://www.libpng.org/pub/png/libpng.html




下载官方推荐的稳定版本httpd-2.2.3.tar.gz,下载地址:http://down.itlearner.com/soft/2356.shtml

安装apache2
#./configure --prefix=/usr/local/apache2 --enable-module=alias --enable-module=most /
--enable-module=vhost_alias --enable-shared=vhost_alias --enable-module=so --enable-shared=max
# make;make install


下载目前最新稳定版本mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
无需安装,解压后移至/usr/local/mysql.

# groupadd mysql #建立mysql组
# useradd mysql -g mysql #建立mysql用户并且加入到mysql组中

# cd /usr/local/mysql

然后设置权限

# chown -R root . #设定root能访问/usr/local/mysql
# chown -R mysql data #设定mysql用户能访问/usr/local/mysql/data ,里面存的是mysql的数据库文件
# chown -R mysql data/. #设定mysql用户能访问/usr/local/mysql/data下的所有文件
# chown -R mysql data/mysql/. #设定mysql用户能访问/usr/local/mysql/data/mysql下的所有文件
# chgrp -R mysql . #设定mysql组能够访问/usr/local/mysql

运行mysql:

# /usr/local/mysql/bin/mysqld_safe --user=mysql &

修改root密码,默认为空:

/usr/local/mysql/bin/mysqladmin -u root password 'newpassword'

MYSQL安装完成


下载最新稳定版本php-5.1.6.tar.gz,下载地址:http://down.itlearner.com/soft/2355.shtml

1. 安装zlib (安装libpng和gd前需要先安装zlib),下载地址:http://down.itlearner.com/soft/2359.shtml
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure
# make;make install

2. 安装libpng,下载地址:http://down.itlearner.com/soft/2362.shtml
# tar zxvf libpng-1.2.12.tar.gz
# cd libpng-1.2.12
# ./configure
# make;make install

3. 安装freetype,下载地址:http://down.itlearner.com/soft/2361.shtml
# tar zxvf freetype-2.2.1.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make;make install

4. 安装jpeg,下载地址:http://down.itlearner.com/soft/2360.shtml
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# mkdir /usr/local/jpeg
# mkdir /usr/local/jpeg/bin
# mkdir /usr/local/jpeg/lib
# mkdir /usr/local/jpeg/include
# mkdir /usr/local/jpeg/man
# mkdir /usr/local/jpeg/man/man1
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
# make;make install

5. 安装gd,下载地址:http://down.itlearner.com/soft/2357.shtml
# tar zxvf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png --with-zlib
//编译过程中会看到如下信息
** Configuration summary for gd 2.0.33:

Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: no
Support for Xpm library: no
Support for pthreads: yes
//可以看到png 、 jpeg 、 freetype都已经安装上了
# make
# make install

//这是在SUSE Linux环境下
6. 正式安装php
# tar zxvf php-5.1.6.tar.gz
# cd php-5.1.6
#./configure--prefix=/usr/local/php5--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql-dir=/usr/include/mysql--with-gd=/usr/local/gd2 --with-zlib --with-png--with-jpeg=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --enable-track-vars --with-config-file-path=/usr/local/lib/

7.整合php和apache
cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/lib/php.ini
将extension=php_mysql.dll前面的#去掉

8. 安装ZendOptimizer,下载地址:http://down.itlearner.com/soft/1023.shtml
# tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
# cd ZendOptimizer-3.0.1-linux-glibc21-i386
# ./install.sh
安装操作: [ok] -> [EXIT] -> [YES] -> [/httpd/zend] ->[/httpd/apache/conf] -> [yes] -> [OK] -> [OK] -> [NO]

遇到的一些错误解决:

1.php5 在configure时提示:configure: error: mysqlconfigurefailed.,只用--with-mysql参数提示:Cannot find MySQL header filesunderyes,去掉--with-mysql参数可以安装,php5将无法连接mysql,页面提示为:Fatal error: Calltoundefined function mysql_connect()。查阅了一下,发现是mysql5对应的版本不对导致的,换个版本就可以了。
我用mysql-standard-5.0.27-linux-i686.tar.gz时会提示,换了mysql-standard-5.0.27-linux-i686-glibc23.tar.gz后就正常了。

2.重装mysql后启动出错,提示:
Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/xmcncn.pid
061103 15:25:32 mysqld ended
请教高手gump,解决方法:
touch /tmp/mysql.sock
killall -9 mysqld
/usr/local/mysql/bin/mysqld_safe -user=mysql &
成功启动


3安装MYSQL时报错
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /var/run/mysqld/mysqld.pid
070206 22:56:06 mysqld ended

解决方法
删除fc4旧版本mysql即目录/var/lib/mysql
重新按照上文方法安装
运行指令chown -R mysql:mysql /var/run/mysqld
运行/usr/local/mysql/中的configure




4软件各版本备忘
fc4
freetype-2.2.1
gd-2.0.33
httpd-2.2.4
jpeg-6b
libpng-1.2.16
php-5.2.0

mysql-5.1.15-beta-linux-i686-glibc23.tar.gz
ZendOptimizer-3.0.1-linux-glibc21-i386
zlib-1.2.3

5数据库无法正常起动
可尝试
#cp support-files/my-medium.cnf /etc/my.cnf /*这时会问是否覆盖重名
cp support-files/mysql.server /etc/
chmod +x /etc/mysql.server
/etc/mysql.server start



6

在配置完httpd.conf后 打开网页可能出现403forbidden

修改此处

#
# Possible values for the Options directive are "None", "All",
# or any combination of:


另外注意wysj文件夹和其中文件的权限最好chmod 775


并且


Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all



中deny from all要屏蔽



编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf

要改的有如下几处:

一般都在
#AddType application/x-tar .tgz
下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .php3 phtml
AddType application/x-httpd-php-source .phps
如果你搜索其它地方没有以下这行

LoadModule php5_module modules/libphp5.so
请把上面的#号去掉

还有找到
DirectoryIndex index.html index.html.var
在后面加 index.php 让它把index.php做为默认页

找到
# don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)

再找
#ServerName
把#去掉,后面的IP改成你的IP.

找到
DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径

为了让中文网页没乱码
找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312 或者是干脆off

分享到:
评论

相关推荐

    openSUSE 11.0 图解安装全过程

    linux openSUSE 11.0 的图解安装全过程

    linux\openSUSE 11.0 图解安装全过程.zip

    标题"linux\openSUSE 11.0 图解安装全过程.zip"指的是一个关于openSUSE 11.0 Linux操作系统详细安装步骤的压缩文件,其中包含图文并茂的教程,方便用户按照指示进行操作。openSUSE是一个开源的Linux发行版,11.0是其...

    Opensuse11.0 软件源添加

    ### Opensuse11.0 软件源添加详解 #### 一、引言 在Linux环境下,软件的安装往往需要通过添加特定的软件源来实现。这些软件源相当于一个庞大的仓库,存放着各种各样的软件包。对于Opensuse11.0来说,合理地配置...

    opensuse11.0_新手_安装指南

    OpenSUSE 11.0 虽然已经较为陈旧,但对于学习Linux基础和理解操作系统工作原理仍是一个良好的平台。随着不断的实践和探索,你会发现Linux世界充满了无限的可能性。希望这个新手安装指南能帮助你顺利开启 OpenSUSE 的...

    OpenSUSE__11.0_and_SUSE__Linux__Enterprise_Server_Bible.pdf(二/二)

    OpenSUSE__11.0_and_SUSE__Linux__Enterprise_Server_Bible.pdf linux opensuse suse 操作系统配置脚本详解。 对于其它类型的linux系统配置也有参考作用,因为所有linux发行版操作系统内部配置大部分都相同。 注意,...

    opensuse使用手册.pdf

    六祎--在原创力花了大价钱买来的,分享... openSUSE Leap 是由社区志愿者和 SUSE 公司雇员一起公开、透明地开发的,openSUSE 这些系统对个人来说是完全免费的,包括使用和在线更新。 1.2 本指南其他语言版本(衍生版)

    OpenSUSE__11.0_and_SUSE__Linux__Enterprise_Server_Bible(一/二)

    OpenSUSE__11.0_and_SUSE__Linux__Enterprise_Server_Bible.pdf linux opensuse suse 操作系统配置脚本详解。 对于其它类型的linux系统配置也有参考作用,因为所有linux发行版操作系统内部配置大部分都相同。 注意,...

    opensuse11+oracle11gr2

    opensuse11 已安装oracle11g 用户名:root,口令:root oracle统一口令:abcd1234

    掌握Linux进程管理:深入查看与结束进程的实用指南

    Linux在各种场合都有广泛应用,从嵌入式设备到超级计算机,在服务器领域确立了地位,通常服务器使用LAMP(Linux + Apache + MySQL + PHP)或LNMP(Linux + Nginx + MySQL + PHP)组合。 Linux的最大优势在于其开源...

    openSUSE 11和SUSE Linux 企业版圣经

    不用多介绍吧,很好的一本书,相信用openSUSE的不能缺少。

    Linux 平台下基于 Rust + GTK 开发的网易云音乐播放器

    netease-cloud-music-gtk4 是基于 GTK4 + Libadwaita 构造的网易云音乐播放器,专为 Linux 系统打造,已在 openSUSE Tumbleweed + GNOME 环境下测试。特点(稳定:专为 Linux 系统打造,相比官方版本拥有更好的兼容...

    LAMP和LNMP服务器部署

    LAMP 和 LNMP 是两种非常流行的 Web 服务器架构,它们分别代表 Linux + Apache + MySQL + PHP 和 Linux + Nginx + MariaDB + PHP。这两种架构均用于搭建高性能的 Web 服务环境。本文将详细介绍 LAMP 和 LNMP 服务器...

    Opensue11.0 网卡配置

    ### Opensuse11.0网卡配置详解 在探讨如何在Opensuse11.0中配置网卡前,我们先简要了解下Opensuse。OpenSUSE是一款免费且开源的操作系统,基于Linux内核,由SUSE Linux和openSUSE项目社区共同维护,其稳定性和安全...

    linux+软件安装+课堂笔记

    Linux 应用领域非常广泛,从嵌入式设备到超级计算机,并且在服务器领域确定了地位,通常服务器使用 LAMP(Linux + Apache + MySQL + PHP)或 LNMP(Linux + Nginx+ MySQL + PHP)组合。目前 Linux 不仅在家庭与企业...

    SuSe Linux 10 宝典 (PDF最新英文版)

    - **定义与历史**:SUSE Linux 10是一款基于GNU/Linux的操作系统,它继承了SUSE Linux的传统,提供了稳定且功能丰富的平台。 - **版本**:本书重点介绍了SUSE Linux 10版本的特点和改进之处。 #### 1.2 特性概述 - ...

Global site tag (gtag.js) - Google Analytics