Chinaunix首页 | 论坛 | 博客
  • 博客访问: 40453
  • 博文数量: 18
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 200
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-15 10:08
文章分类

全部博文(18)

文章存档

2014年(1)

2010年(4)

2009年(13)

我的朋友

分类: LINUX

2009-11-17 16:35:11

Apache2+PHP5+MySQL(LAMP)
网上有很多文章是介绍LAMP的这二天有空我也做了一了一篇
下面是我的虚拟机上的实验
首先上传相关的包。

[root@localhost ~]# ls

anaconda-ks.cfg                    httpd-2.2.14.tar.gz  rrdtool-1.4.0.tar.gz

cacti-spine-0.8.7e.tar.gz          install.log          vpn    

config                             install.log.syslog  

config.tar                         mysql-5.0.87.tar.gz 

ez-ipupdate                        net-snmp-5.5.tar.gz   

ez-ipupdate-3.0.10-linux-i386.tgz  php-5.3.0.tar.gz          

                      :注这里都是源码安装

 [root@localhost ~]#tar zxvf mysql-5.0.87.tar.gz                     解压mysql

[root@localhost ~]#make

[root@localhost ~]#make install

[root@localhost mysql-5.0.87]# useradd myaql           创建mysql 用户

[root@localhost mysql-5.0.87]# passwd myaql           创建密码

[root@localhost mysql-5.0.87]#./configure –prefix =/opt/mysql5 安装路径

[root@localhost mysql-5.1.40]# cp support-files/my-medium.cnf /etc/my.cnf  按文档做

[root@localhost mysql-5.1.40]# cd /opt/mysql5/

[root@localhost mysql5]# ll

total 28

drwxr-xr-x   2 root root 4096 Nov 16 01:03 bin

drwxr-xr-x   3 root root 4096 Nov 16 01:01 include

drwxr-xr-x   3 root root 4096 Nov 16 01:01 lib

drwxr-xr-x   2 root root 4096 Nov 16 01:06 libexec

drwxr-xr-x  10 root root 4096 Nov 16 01:06 mysql-test

drwxr-xr-x   6 root root 4096 Nov 16 01:06 share

drwxr-xr-x   5 root root 4096 Nov 16 01:06 sql-bench

[root@localhost mysql5]# chown -R mysql .         

 

设置权限

[root@localhost mysql5]# bin/mysql_install_db --user=mysql  执行这条指令

Installing MySQL system tables...

OK

Filling help tables...

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

 

/opt/mysql5/bin/mysqladmin -u root password 'new-password'

/opt/mysql5/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

 

Alternatively you can run:

/opt/mysql5/bin/mysql_secure_installation

 

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

cd /opt/mysql5 ; /opt/mysql5/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd /opt/mysql5/mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /opt/mysql5/bin/mysqlbug script!

 

The latest information about MySQL is available at

Support MySQL by buying support/licenses from

[root@localhost mysql5]# chown -R root .

 [root@localhost mysql5]# chown -R mysql var  权限

[root@localhost mysql5]# cd bin

[root@localhost bin]# pwd

[root@localhost ~]#/opt/mysql5/bin

[root@localhost bin]# ./mysqld_safe --user=mysql &  让mysqld放在后台执行

[root@localhost mysql5]# cd bin

[root@localhost bin]# ./mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.40-log Source distribution

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show databases;           测试mysql 是否正常查询

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+

3 rows in set (0.01 sec)

[root@localhost bin]# ./mysqladmin shutdown    关闭mysql

 

[root@localhost ~]#Tar zxvf httpd-2.2.14.tar.gz

解压内容省……

 

[root@localhost ~]#Tar zxvf php-5.3.0.tar.gz

 

[root@localhost ~]# cd httpd-2.2.14

[root@localhost httpd-2.2.14]# ./configure --enable-so --prefix=/opt/www 配置指定路径以动态库的方式(enable-so

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

 

Configuring Apache Portable Runtime library ...

 

checking for APR... reconfig

configuring package in srclib/apr now

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

Configuring APR library

Platform: i686-pc-linux-gnu

checking for working mkdir -p... yes

APR Version: 1.3.9

checking for chosen layout... apr

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/root/httpd-2.2.14/srclib/apr':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details.

configure failed for srclib/apr

make && makeinstall

 

[root@localhost php-5.3.0]# ./configure--with-apxs2=/opt/www/bin/apxs --with-mysql=/opt/mysql5 配置PHP 指定mysql

creating cache ./config.cache

checking for Cygwin environment... no

checking for mingw32 environment... no

checking for egrep... grep -E

checking for a sed that does not truncate output... /bin/sed

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

后面省………

[root@localhost php-5.3.0]# make

……..

[root@localhost php-5.3.0]# make install

Installing PHP SAPI module:       apache2handler

/opt/www/build/instdso.sh SH_LIBTOOL='/opt/www/build/libtool' libphp5.la /opt/www/modules

/opt/www/build/libtool --mode=install cp libphp5.la /opt/www/modules/

cp .libs/libphp5.so /opt/www/modules/libphp5.so

cp .libs/libphp5.lai /opt/www/modules/libphp5.la

libtool: install: warning: remember to run `libtool --finish /root/php-5.3.0/lib

………..

[root@localhost php-5.3.0 cp php.ini-development /usr/local/lib/php.ini 复制这个文件

[root@localhost ~]# cd /opt/www

[root@localhost www]# ls

bin    cgi-bin  error   icons    lib   man     modules

build  conf     htdocs  include  logs  manual

[root@localhost www]# cd conf

[root@localhost conf]# ls

extra  httpd.conf  httpd.conf.bak  magic  mime.types  original

[root@localhost conf]# vi httpd.conf

[root@localhost conf]#AddType application/x-httpd-php .php .phtml 增加这一项]

[root@localhost ~]# /opt/www/bin/apachectl start  启动apachect

测试httpd 是否工作正常

[root@localhost ~]# ps -ef | grep httpd

root     30747     1  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

daemon   30748 30747  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

daemon   30749 30747  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

daemon   30750 30747  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

daemon   30751 30747  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

daemon   30752 30747  0 20:59 ?        00:00:00 /opt/www/bin/httpd -k start

root     30754 30704  3 21:00 pts/4    00:00:00 grep httpd

说明已经正常工作了。[root@localhost ~]# cd /opt/www/htdocs/

[root@localhost htdocs]# ls

index.html

[root@localhost htdocs]# vi test.php

 

<php

Phpinfo();

>

下面测试没问题了。

阅读(661) | 评论(0) | 转发(0) |
0

上一篇:linux 防火墙

下一篇:ExChange 2007 安装说明

给主人留下些什么吧!~~