setup lamp server

first see
http://dan.drydog.com/apache2php.html#installing
then, this is addon
1。安装apache-2.2.11
./configure
make
make install
然后在 ~/.bash_profile 文件中添加
PATH=$PATHHOME/bin:/usr/local/apache2/bin
这 样为了方便启用、关闭apache
 
2。安装mysql(mysql-5.1.30-linux-i686- icc-glibc23.tar.gz)
这里采用的是mysql的二进制版本(32位),并为Intel构架优化过的
参 考:[url]http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html[/url]
【备注】
刚开始这个版本在 rhel5 上运行 scripts/mysql_install_db --user=mysql 失败
改用版本 mysql-5.0.67-linux-i686-icc-glibc23.tar.gz 安装正常,后来发现在
/var/lib/mysql 目录下有以前5.0版本的数据,可能由于兼容性导致5.1版本安装不正常,
于是我将原来的数据删除即可正常安装 5.1 版本。


shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
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
shell> bin/mysqld_safe --user=mysql &
--------------------------------------------------------------------------------

[root@miix mysql]# scripts/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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h miix.hoho.com password 'new-password'
Alternatively you can run:
./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 . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available at [url]http://www.mysql.com/[/url]
Support MySQL by buying support/licenses from [url]http://shop.mysql.com/[/url]
--------------------------------------------------------------------------------
 
安装完毕后根据以上的提示,别忘了设置mysql root用户密码,我另外新建一个用户 zhaozh
mysql> grant all on *.* to zhaozh@localhost identified by '××××××'
 
3。安装php-5.2.8
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli --with-gd --with-jpeg-dir --with-png-dir
make
make install
cp php.ini-dist /usr/local/lib/php.ini
php安装完后,在 /usr/local/apache2/modules 添加了动态连接库 libphp5.so
如果在启动或者重启apache时候,出现以下信息:
[root@miix htdocs]# apachectl -k restart
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
这是由于selinux引起的,所以需要这样一下:
chcon -t textrel_shlib_t libphp5.so
php安装完后,在 /usr/local/apache2/conf/httpd.conf 添加了一行:
LoadModule php5_module        modules/libphp5.so
本人不想采用这种方式,于是将上述一行注释掉,然后在 httpd.conf 文件末尾添加:
Include conf/conf.d/*.conf
接着建立目录 /usr/local/apache2/conf/conf.d
添加 php.conf 文件,内容如下:
--------------------------------------------------------------------------------
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
--------------------------------------------------------------------------------
重启apache,在 /usr/local/apache2/htdocs 目录下建立一个 test.php 文件,如下
<?php phpinfo(); ?>
在浏览器输入 [url]http://ip/test.php[/url] ,如果能正常显示出php信息则说明apache+php OK了。
 
------------------------------------------------------------------------------------------



     相关文章
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值