天天看点

linux下的PHP+Mysql+PHPWind实现

linux下的PHP+Mysql+PHPWind实现

1安装httpd、mysql mysql-server php php-mysql php-mbstring

yum -y install mysql mysql-server

yum -y php php-mysql php-mbstring 

2.开启httpd、Mysql 并为Mysql设置密码

service httpd  start

service mysqld  start

mysqladmin -u root -p password '123456'

3.由于装了php,所以会在/etc/httpd/conf.d/目录里多一个php.conf文件

<a href="http://blog.51cto.com/attachment/201210/210927360.png" target="_blank"></a>

4.在/var/www/html/目录里新建index.php内容如下:

&lt;?php

phpinfo();

?&gt;

5.测试一下php和httpd及mysql的是否关联

<a href="http://blog.51cto.com/attachment/201210/211053570.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/211106286.png" target="_blank"></a>

已关联

为了方便mysql的管理,我们需要phpmyadmin的web方式的管理

软件包为phpMyAdmin-2.11.10.1-all-languages.zip通过ftp上传到问我们的服务器,

解压unzip phpMyAdmin-2.11.10.1-all-languages.zip

移动到/var/www/html/目录里并改名为phpmyadmin

mv phpMyAdmin-2.11.10.1-all-languages /var/www/html/phpmyadmin

<a href="http://blog.51cto.com/attachment/201210/211214400.png" target="_blank"></a>

客户机访问

<a href="http://blog.51cto.com/attachment/201210/211231297.png" target="_blank"></a>

会发现有“错误”,但是能访问了,下面解决这个错误:

切换到/var/www/html/phpmyadmin/目录里

cp config.sample.inc.php config.inc.php

编辑vim config.inc.php

<a href="http://blog.51cto.com/attachment/201210/211404679.png" target="_blank"></a>

在“红框里”随意写一些内容,开启cookie

再次客户机访问(记得之前要重启httpd)

<a href="http://blog.51cto.com/attachment/201210/211430502.png" target="_blank"></a>

没有错误了,输入用户名和密码就可以进入了

<a href="http://blog.51cto.com/attachment/201210/211513523.png" target="_blank"></a>

但是你还会发现有一个感叹号即“无法载入scrypt扩展”,解决方法是安装该扩展即

(libmcrypt-2.5.7-5.el5.i386.rpm、php-mcrypt-5.1.6-5.el5.i386.rpm)通过ftp上传到服务器

Yum  -y  localinstall libmcrypt-2.5.7-5.el5.i386.rpm

php-mcrypt-5.1.6-5.el5.i386.rpm  --nogpgcheck

重启httpd后,再次客户机访问

<a href="http://blog.51cto.com/attachment/201210/211618752.png" target="_blank"></a>

一切正常

下面实现phpwind论坛

论坛包为phpwind_GBK_8.3.zip通过ftp上传到服务器

解压unzip phpwind_GBK_8.3.zip

切换到phpwind_GBK_8.3目录里

cd phpwind_GBK_8.3

<a href="http://blog.51cto.com/attachment/201210/211648560.png" target="_blank"></a>

将upload还转移到/var/www/html/并重命名为phpwind

mv uploa /var/www/html/phpwind

<a href="http://blog.51cto.com/attachment/201210/211701251.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/211715109.png" target="_blank"></a>

会看到什么也没,这是编码造成的,在浏览器中选择如下图:

<a href="http://blog.51cto.com/attachment/201210/211829811.png" target="_blank"></a>

选择“简体中文”

<a href="http://blog.51cto.com/attachment/201210/211942709.png" target="_blank"></a>

看到了,但是每次都这样改有点麻烦,我们可以修改

/etc/httpd/conf/httpd.conf文件来实现 第746行改为GB2312

<a href="http://blog.51cto.com/attachment/201210/212003589.png" target="_blank"></a>

重启httpd就可以了

论坛的安装

<a href="http://blog.51cto.com/attachment/201210/212016757.png" target="_blank"></a>

按要求更改“红框里“的目录权限为777

<a href="http://blog.51cto.com/attachment/201210/212056476.png" target="_blank"></a>

单击“开始安装”》“同意协议,下一步”》

<a href="http://blog.51cto.com/attachment/201210/212108454.png" target="_blank"></a>

单击下一步》下一步

<a href="http://blog.51cto.com/attachment/201210/212127311.png" target="_blank"></a>

单击“关闭”并在服务器端删除install.php文件

<a href="http://blog.51cto.com/attachment/201210/212139957.png" target="_blank"></a>

再次进入就是论坛主页面了如下:

<a href="http://blog.51cto.com/attachment/201210/212156820.png" target="_blank"></a>

事实上phpwind目录即论坛网站可以不在/var/www/html/下,可以放在任何位置,通过虚拟目录来实现。。。

实验完毕。。。

本文转自 abc16810 51CTO博客,原文链接:http://blog.51cto.com/abc16810/1034856