搭建LAMP环境
自从毕业之后工作 还没搭建成功过,今天终于弄好了,以下是我的个人总结:apache的搭建
tar zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
# make && make install
# /usr/local/apache2/bin/apachect1 start
查看下默认网页是否可以访问,一般都是不出问题的
下边开始安装数据库:
# useradd mysql
# tar zxvf mysql-5.0.45.tar.gz -C /usr/local/
# ./configure --prefix=/usr/local/mysql
# make && make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# ./bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var/
# ./bin/mysqld_safe --user=mysql &
设置mysqld服务开机启动
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod 755 /etc/init.d/mysqld
# chkconfig --level 345 mysqld on
配置环境变量
将mysql的bin目录加入到PATH中,在/etc/profile中加入mysql/bin
export PATH=/opt/mysql/mysql/bin:$PATH
PHP的连接
# tar zxvf php-5.2.5.tar.gz -C /usr/local/src/
# cd /usr/local/src/php-5.2.5/
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5 --with-zlib=/usr/local/mysql/ --with-zlib --with-mysql=/usr/local/mysql
# make && make install
# cp php.ini-dist /usr/local/php5/php.ini
# vi /usr/local/apache2/conf/httpd.conf
在这行下边
LoadModule php5_module modules/libphp5.so
添加
AddType application/x-httpd-php .php
找到DirectoryIddex index.html index.html.var
修改为
DirectoryIndex index.html index.html.var index.php
# /usr/local/apache2/bin/apachectl restart
其中在安装PHP的时候遇到了些问题
./configure时出现以下错误。
提示这个错误时:
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
网上搜的解决方法是以下三种,我的系统是centos ,上次是用第一种解决的,今天是用第二种解决的。。
1. 查看系统有没有安装mysql header
find / -name mysql.h
如果有。请指定--with-mysql=/跟正常路径。
如果没有。请看下一步。
2.redhat安装
rpm -ivh MySQL-devel-community-5.1.33-0.rhel5.i386.rpm
3.最后一步php的配置选项添加--with-mysql=/usr即可!
页:
[1]