Linux下LAMP+Phpwind环境搭建

安装包下载链接:http://pan.baidu.com/s/1qYyndak 密码:58et

本文使用Centos6.5linux操作系统

内核版本[root@daihy ]# uname -r
2.6.32-431.el6.x86_64
mysql 采用二进制包安装,mysql版本mysql-5.1.73-linux-x86_64-glibc23.tar.gz
安装mysql   一 ,首先卸载系统自带的mysql包安装文件。

rpm -qa | grep mysql*

yum remove mysql*

二,创建用户和组

groupadd mysql

useradd mysql -s /sbin/nologin -g mysql -M

创建数据库数据路径mkdir -p /data/mysql

chown mysql:mysql /data/mysql

三, 解压二进制安装包

tar -zxvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz -C/usr/local

进入解压路径cd /usr/local  查看ls

移动并重命名mv mysql-5.1.73-linux-x86_64-glibc23 /usr/local/mysql

进入/usr/local/mysql复制mysql的配置文件

[root@daihy support-files]# cp my-large.cnf /etc/my.cnf复制mysql的启动文件

[root@daihy support-files]# cp mysql.server/etc/init.d/mysqld更改启动文件添加

vim /etc/init.d/mysqld

basedir=/usr/local/mysql
                                  

datadir=/data/mysql
 四,初始化

[root@daihy mysql]# ./scripts/mysql_install_db --user=mysql--datadir=/data/mysql

会看到两个OK

五,启动

[root@daihy mysql]# /etc/init.d/mysqld start

Starting MySQL SUCCESS!

六,检查

[root@daihy mysql]# ps aux | grep mysql
root       2261  0.0  0.1 11304  1472 pts/0    S    21:06  0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql--pid-file=/data/mysql/daihy.com.pid
mysql      2374  0.0  7.3 619004 73628pts/0    Sl   21:06   0:00/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql--user=mysql --log-error=/data/mysql/daihy.com.err--pid-file=/data/mysql/daihy.com.pid --socket=/tmp/mysql.sock --port=3306
root       2540  0.0  0.0103248   876 pts/0    S+   21:35  0:00 grep mysql

说明正常启动!!

mysql参数查看

[root@daihy ~]# cat /usr/local/mysql/bin/mysqlbug | grepconfigure

进入数据库

[root@daihy ~]# /usr/local/mysql/bin/mysql

[root@daihy ~]# /usr/local/mysql//bin/mysqladmin -u rootpassword '111111'

[root@daihy ~]# /usr/local/mysql/bin/mysql -u root -p111111

apache安装

源码包安装httpd-2.2.31.tar.gz

mkdir  /usr/local/apache2

 

如果不知道怎么安装可以查看INSTALL和README这两个文件

安装./configure --prefix=/usr/local/apache2--with-included-apr --with-pcre --enable-mods-shared=most

make&&make install

安装完成启动查看

[root@daihy ~]# /usr/local/apache2/bin/apachectl start
[root@daihy ~]# netstat -antp | grep httpd
tcp        0      0:::80                      :::*                       LISTEN      75493/httpd   

[root@daihy ~]# ps aux | grep httpd
看apache的编译参数

[root@daihy ~]# cat /usr/local/apache2/build/config.nice

查看apache编译的模块

[root@daihy ~]# /usr/local/apache2/bin/apachectl -M

PHP安装:

mkdir /usr/local/php

PHP版本php-5.3.28.tar.gz

[root@daihy local]# cd src/
[root@daihy src]# ls
httpd-2.2.31  php-5.3.28

[root@daihy php-5.3.28]# ./configure--prefix=/usr/local/php/ --with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/--with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir--with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt--enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets--enable-exif --disable-ipv6

报错内容:configure: error: mcrypt.h not found. Pleasereinstall libmcrypt

1.  #使用wget可以通过以下路径下载  

2.  wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz 

3.  #解压  

4.  tar -zxvf libmcrypt-2.5.7.tar.gz

5.  #进入目录  

6.  cd libmcrypt-2.5.7 

7.  #编译(默认安装到/usr/local/lib/)  

8.  ./configure --prefix=/usr/local/libmcrypt  

9.  #执行安装  

10.make && make install

然后在初始化路径中添加对应的路径--with-mcrypt=/usr/local/libmcrypt/

 或者下载epel源,在源中查找安装

其他错误按着相应操作查找安装yum list | grep 缺少的


make

用echo $?检测是否有错,返回值为0.则代表没错,非零有错。

make install

ldd 查看php的编译模块/usr/local/apache2/modules/libphp5.so

查看php详细信息

[root@daihy php]# /usr/local/php/bin/php -i | less

查看加载了哪些模块

[root@daihy php]# /usr/local/php/bin/php -m | less


可以看见Configuration File (php.ini) Path =>/usr/local/php/etc
没有php.ini文件,我们copy一个进来


php.ini-development 代表开发环境。另一个代表生产环境

再次查看Loaded Configuration File =>/usr/local/php/etc/php.ini

在客户端测试apache

 

验证是否支持php解析


[root@www htdocs]# ls

1.php  index.html

[root@www htdocs]# cat 1.php

<?php

phpinfo();

?>

[root@www htdocs]#

在/usr/local/apache2/conf/httpd.conf中加入


[root@daihy conf]# /usr/local/apache2/bin/apachectl -t 检测是否有语法错误

在浏览器查看

 

[root@daihy ~]# unzip phpwind_GBK_8.5.zip   #解压文件

[root@www ~]# cd phpwind_GBK_8.5

[root@www phpwind_GBK_8.5]# ls

docs  upload

[root@www phpwind_GBK_8.5]# cp -R upload//usr/local/apache/htdocs/phpwind    

#将upload/目录拷贝到/usr/local/apache/htdocs中,并重命名为phpwind

[root@daihy phpwind_GBK_8.5]# cd/usr/local/apache/htdocs/

[root@daihy htdocs]# ls

1.  php  index.html phpwind

登录访问:http://192.168.130.150/phpwind/install.php

  


[root@ldaihy htdocs]# cd phpwind/

[root@daihy phpwind]# chmod-R  777  attachment/        #更改attachment极其所含文件的属性为777,-R表示递归

[root@daihy phpwind]# chmod-R  777  data/           #更改data极其所含文件的属性为777,-R表示递归

[root@daihy phpwind]# chmod-R  777  html/          #更改html极其所含文件的属性为777,-R表示递归

[root@daihy phpwind]# /usr/local/apache/bin/apachectlrestart          #重启apache服务

 

[root@daihy ~]# /usr/local/mysql//bin/mysqladmin -u rootpassword '111111'

[root@daihy ~]# /usr/local/mysql/bin/mysql -u root -p111111

 

无法设置密码的情况:

#1.停止mysql数据库

/etc/init.d/mysqld stop 

#2.执行如下命令

mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 

#3.使用root登录mysql数据库

mysql -u root mysql 

#4.更新root密码

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

#5.刷新权限 

mysql> FLUSH PRIVILEGES; 

#6.退出mysql

mysql> quit 

#7.重启mysql

/etc/init.d/mysqld restart 

#8.使用root用户重新登录mysql

mysql -uroot -p 

Enter password: <输入新设的密码newpassword>

 


[root@daihy phpwind]# rm install.php         #按照上面提示,将isntall.php删除


 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值