php、mysql基础
需先安装httpd服务,使得web服务器启用。
一、安装PHP
[root@johntest ~]# ls #先下载rpm安装包
php53-5.3.3-23.el5_10.x86_64.rpm sys dead.letter inittab.des3
php53-cli-5.3.3-23.el5_10.x86_64.rpm sysroo1.gz install.log.syslog
php53-common-5.3.3-23.el5_10.x86_64.rpm dev php53-mbstring-5.3.3-23.el5_10.x86_64.rpm
dropbear-2013.56 ks.cfg php53-mysql-5.3.3-23.el5_10.x86_64.rpm
dropbear-2013.56.tar.bz2 lib php53-pdo-5.3.3-23.el5_10.x86_64.rpm
[root@johntest ~]# rpm -ivh php53-common-5.3.3-23.el5_10.x86_64.rpm
warning: php53-common-5.3.3-23.el5_10.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53-common ########################################### [100%]
[root@johntest ~]# rpm -ivh php53-cli-5.3.3-23.el5_10.x86_64.rpm
warning: php53-cli-5.3.3-23.el5_10.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53-cli ########################################### [100%]
[root@johntest ~]# rpm -ivh php53-mbstring-5.3.3-23.el5_10.x86_64.rpm
warning: php53-mbstring-5.3.3-23.el5_10.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53-mbstring ########################################### [100%]
[root@johntest ~]# rpm -ivh php53-5.3.3-23.el5_10.x86_64.rpm
warning: php53-5.3.3-23.el5_10.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53 ########################################### [100%]
[root@johntest ~]# rpm -ivh php53-mysql-5.3.3-23.el5_10.x86_64.rpm
warning: php53-mysql-5.3.3-23.el5_10.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
php53-pdo is needed by php53-mysql-5.3.3-23.el5_10.x86_64 #提示依赖php53-pdo
[root@johntest ~]# rpm -ivh php53-pdo-5.3.3-23.el5_10.x86_64.rpm
warning: php53-pdo-5.3.3-23.el5_10.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53-pdo ########################################### [100%]
[root@johntest ~]# rpm -ivh php53-mysql-5.3.3-23.el5_10.x86_64.rpm
warning: php53-mysql-5.3.3-23.el5_10.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:php53-mysql ########################################### [100%]
[root@johntest ~]# cd /var/www/a.com/
[root@johntest a.com]# vim index.php #内容修改为以下
<title>a.com</title>
<h2>test a.com</h2>
<?php
$conn=mysql_connect('localhost','root','123456');
if ($conn)
echo "Success...";
else
echo "Failure...";
?>
[root@johntest a.com]# service httpd restart #重启httpd服务
停止 httpd: [确定]
启动 httpd: [确定]
[root@johntest a.com]# service mysqld restart #重启mysqld服务
停止 MySQL: [确定]
启动 MySQL: [确定]
通过网页访问如下:
1、使用phpMyAdmin提供管理mysql界面部署网站:
首先下载phpMyAdmin:
[root@johntest ~]# ls
dropbear-2013.56.tar.bz2 php53-pdo-5.3.3-23.el5_10.x86_64.rpm
etc phpMyAdmin-3.4.9-all-languages.zip
[root@johntest ~]# mv phpMyAdmin-3.4.9-all-languages /var/www/a.com/
[root@johntest ~]# cd /var/www/a.com/
[root@johntest a.com]# ls
index.php phpMyAdmin-3.4.9-all-languages
[root@johntest a.com]# mv phpMyAdmin-3.4.9-all-languages pma
[root@johntest a.com]# ls
index.php pma
在客户端通过以下网址即可登录php管理数据库界面:www.a.com/pma
2、通过discuz部署论坛网页:
首先下载discuz x2.5版本:http://www.discuz.net/thread-2744369-1-1.html
[root@johntest ~]# ls
......
Discuz_X2.5_SC_UTF8.zip php53-mysql-5.3.3-23.el5_10.x86_64.rpm
......
[root@johntest ~]# unzip Discuz_X2.5_SC_UTF8.zip #解压该压缩包
[root@johntest ~]# rm -rf /var/www/b.com/* #先把b.com中的内容清空
[root@johntest ~]# mv upload/* /var/www/b.com/ 把刚才解压出来的upload文目录中的文件都移 至需要配置部署的网址目录中/var/www/b.com
[root@johntest ~]# ls /var/www/b.com/
admin.php config data home.php member.php robots.txt template
api connect.php favicon.ico misc.php search.php uc_client
api.php cp.php forum.php index.php plugin.php source uc_server
archiver crossdomain.xml group.php install portal.php static userapp.php
在客户端网页中输入:www.b.com
如果打开网站提示乱码,是下载的discuz语言不一致导致,需注释掉/etc/httpd/conf/httpd.conf主配置文件中的#AddDefaultCharset UTF-8 这行内容。
把上图红色框内的文件和目录的权限都修改为777:
[root@johntest b.com]# chmod 777 ./config/config_global_default.php
[root@johntest b.com]# chmod 777 ./config/config_ucenter_default.php
[root@johntest b.com]# chmod 777 ./config
[root@johntest b.com]# chmod 777 ./data
[root@johntest b.com]# chmod 777 ./data/cache
[root@johntest b.com]# chmod 777 ./data/avatar
[root@johntest b.com]# chmod 777 ./data/plugindata
[root@johntest b.com]# chmod 777 ./data/download
[root@johntest b.com]# chmod 777 ./data/addonmd5
[root@johntest b.com]# chmod 777 ./data/template
[root@johntest b.com]# chmod 777 ./data/threadcache
[root@johntest b.com]# chmod 777 ./data/p_w_upload
[root@johntest b.com]# chmod 777 ./data/p_w_upload/album
[root@johntest b.com]# chmod 777 ./data/p_w_upload/forum
[root@johntest b.com]# chmod 777 ./data/p_w_upload/group
[root@johntest b.com]# chmod 777 ./data/log
[root@johntest b.com]# chmod 777 ./uc_
uc_client/ uc_server/
[root@johntest b.com]# chmod 777 ./uc_client/data/cache
[root@johntest b.com]# chmod 777 ./uc_server/data/
[root@johntest b.com]# chmod 777 ./uc_server/data/{cache,avatar,backup,logs,tmp,view}
修改完成后,刷新网站,如下:
[root@johntest b.com]# cd install
[root@johntest install]# ls
data p_w_picpaths include index.php
[root@johntest install]# mv index.php index.php.bak
至此一个论坛模板的网站已经建立,并可以进行后台管理。
3、通过workpress部署博客网页:
首先下载workpress4.7.2版本:https://cn.wordpress.org/
[root@johntest ~]# ls
wordpress-4.7.2-zh_CN.zip
[root@johntest ~]# unzip wordpress-4.7.2-zh_CN.zip
[root@johntest ~]# cd wordpress
[root@johntest wordpress]# ls
index.php wp-admin wp-content wp-load.php wp-signup.php
license.txt wp-blog-header.php wp-cron.php wp-login.php wp-trackback.php
readme.html wp-comments-post.php wp-includes wp-mail.php xmlrpc.php
wp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php
[root@johntest wordpress]# ls /var/www/weblinux.com/
index.html
[root@johntest wordpress]# rm /var/www/weblinux.com/* -rf
[root@johntest wordpress]# ls /var/www/weblinux.com/
[root@johntest wordpress]# cd /var/www/weblinux.com/
[root@johntest weblinux.com]# ls
index.php wp-admin wp-content wp-load.php wp-signup.php
license.txt wp-blog-header.php wp-cron.php wp-login.php
wp-trackback.php readme.html wp-comments-post.php wp-includes wp-mail.php xmlrpc.phpwp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php
在客户端网页中输入:www.weblinux.com
可能在配置过程中会出现点小错误,按照错误提示设置即可。 至此wordpress博客网页就建立成功。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。