手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 6.3安装配置LAMP服务器(Linux+Apache+MySQL+PHP5)

[日期:2012-11-19] 来源:Linux社区  作者:yanghuawu [字体: ]

6、安装PHP5
 
检查是否安装php,使用YUM 自动安装:
 
[root@server ~]# rpm –qa |grep php
 
[root@server ~]# yum -y install php    #根据提示输入Y直到安装完成
 
 
 
安装PHP组件,使 PHP5 支持 MySQL
 
[root@server ~]# yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
 
 #这里选择以上安装包进行安装,根据提示输入Y回车
 
 
 
重启MySql
 
[root@server ~]# service mysqld restart
 
停止 mysqld:                                              [确定]
 
正在启动 mysqld:                                          [确定]
 
 
 
重启Apche
 
[root@server ~]# service httpd restart
 
停止 httpd:                                              [确定]
 
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for server
 
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 
                                                          [确定]
 
 
 
配置编辑文件:                                                         
 
7、Apache配置
 
个人习惯,修改配置文件首先要备份。
 
[root@server ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.confbak  #备份
 
[root@server ~]# vim /etc/httpd/conf/httpd.conf  #编辑文件
 
小提示:
 
:set nu    #显示行号
 
:set nonu  #取消行号
 
pgUp        #上一页
 
pgDn        #下一页
 
 
 
 44 ServerTokens OS  #在44行 修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的名称)
 
536 ServerSignature On  #在536行 修改为:ServerSignature Off (在错误页中不显示Apache的版本)
 
331 Options Indexes FollowSymLinks  #在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
 
796 #AddHandler cgi-script .cgi #在796行 取消“#” 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
 
338 AllowOverride None  #在338行 修改为:AllowOverride All (允许.htaccess)
 
759 AddDefaultCharset UTF-8 #在759行 修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
 
554 Options Indexes MultiViews FollowSymLinks #在554行 修改为 Options MultiViews FollowSymLinks(不在浏览器上显示树状目录结构)
 
402 DirectoryIndex index.html index.html.var #在402行 修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php Default.php index.html.var (设置默认首页文件,增加index.php)
 
 76 KeepAlive Off #在76行 修改为:KeepAlive On (允许程序性联机)
 
 83 MaxKeepAliveRequests 100  #在83行 修改为:MaxKeepAliveRequests 1000 (增加同时连接数)
 
:wq  #保存退出
 
 
 
重启
 
[root@server ~]# service httpd restart
 
停止 httpd:                                              [确定]
 
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for server
 
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 
                                                          [确定]
 
[root@server ~]# cp /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.confbak    #备份
 
[root@server ~]# cp /var/www/error/noindex.html /var/www/error/noindex.htmlbak      #备份
 
[root@server ~]# rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html    #删除默认2个测试页
 
 
 
重启
 
[root@server ~]# service httpd restart
 
停止 httpd:                                              [确定]
 
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for server
 
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 
                                                          [确定]
 
 
 
浏览器访问:http://10.1.4.44

CentOS 6.3安装配置LAMP服务器(Linux+Apache+MySQL+PHP5)

linux
相关资讯       lamp  CentOS LAMP  CentOS 6.3安装LAMP  CentOS 6.3 LAMP 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款