安装和配置LAMP(Linux Apache Mysql PHP) - fun - fun

安装和配置LAMP(Linux Apache Mysql PHP)

abelard posted @ 2011年4月14日 10:38 in linux系统管理 , 2457 阅读

安装顺序:

1. linux: CentOS 5.5 -- 内核版本:2.6.18-194.e15

2. MySql:下载了官网的mysql-5.5.11.tar.gz,解压后安装INSTALL-SOURCE的“2.9.2. Installing MySQL from a Standard Source Distribution”,进行了如下的安装操作:(以上是初始安装时,所执行的步骤! 没有检查是否需要这么多!!!)

shell> groupadd mysql
shell> useradd -r -g mysql mysql

shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install

shell> cd /usr/local/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

而后,就可以执行 2.10.1. Unix Postinstallation Procedures 中的(之前6步基本上在上面的步骤中都执行过了,可以对照看看缺哪些步骤)

 7. Start the MySQL server:
shell> bin/mysqld_safe --user=mysql &

然后可以看看mysql server是否正常运行了:没有问题的话,应该看到如它说的结果

shell> bin/mysqladmin version
shell> bin/mysqladmin variables
shell> bin/mysqladmin -u root shutdown //测试是否可以关闭
shell> bin/mysqld_safe --user=mysql &
shell> bin/mysqlshow

给跟用户添加个密码:

shell> mysqladmin -u root password "newpwd"

3. Apache:下载了官网的 httpd-2.2.17.tar.gz,解压后按照php-5.3.6下的INSTALL文件的chapter 2 Apache 2.0 on Unix systems所描述的步骤执行:

(6).  ./configure --enable-so    //1-5的步骤就不说了^_^
(7).  make
(8).  make install

执行:    /usr/local/apache2/bin/apachectl start 后,测试一下,如:http://192.168.0.84/ 得到:"It Works"

说明apache2 ok了

4.php: 下载了官网的php-5.3.6.tar.gz,解压后,按照INSTALL文件的chapter 2 Apache 2.0 on Unix systems所描述的步骤执行:

(10). ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/loca/mysql   //文档上没说要加/usr/loca/mysql,但不加出错了!!!

(11). make
(12). make install

插曲:在安装上面这些玩意之前,Centos已经有httpd 2.1.13,以为可以不用从源码编译apache,于是做了上面的2和4,没有3,

后来发现必须编译apache,就把原来的httpd用yum删除掉了,按照上面的3执行,测试没有问题,当然也就重新执行了4中的步骤,但是再去测试apache(用/usr/local/apache2/bin/apachectl start)发现不好使了出现了一个错误:

 

apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: undefined symbol: zend_parse_parameters

网上说了几个办法好像都不解决,知道找到了下面这段话:--来自这里

 

I had this same problem and what I did was delete my php source directory, re-extract the tarball and then compile again and everything worked fine.

I had previously installed php on this system without apache and then I had tried reinstalling php from the same source directory with different config settings.

于是,重新解压一个,执行所有步骤,一切ok了!

 

 


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee