PHP的简介

PHP于1994年由Rasmus Lerdorf创建,刚刚开始是Rasmus Lerdorf 为了要维护个人网页而制作的一个简单的用Perl语言编写的程序。这些工具程序用来显示 Rasmus Lerdorf 的个人履历,以及统计网页流量。后来又用C语言重新编写,包括可以访问数据库。他将这些程序和一些表单直译器整合起来,称为 PHP/FI。PHP/FI 可以和数据库连接,产生简单的动态网页程序.......[参考百科]

PHP的官方网址:http://www.php.net/

PHP安装配置

首先去官网http://cn2.php.net/downloads.php下载最新版的安装包或你需要的版本,本次实验的系统环境为Red Hat Enterprise Linux Server release 5.7 64bit。这篇文章是安装配置nagios的过程

Code Snippet
  1. [root@getlnx05 kerry]# tar zxvf php-5.4.10.tar.gz
  2. [root@getlnx05 kerry]# cdphp-5.4.10
  3. [root@getlnx05 php-5.4.10]#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs

报错详细信息:

General settings

checking whether to include gcov symbols... no

checking whether to include debugging symbols... no

checking layout of installed files... PHP

checking path to configuration file... DEFAULT

checking where to scan for configuration files...

checking whether to enable PHP's own SIGCHLD handler... no

checking whether to explicitly link against libgcc... no

checking whether to enable short tags by default... yes

checking whether to enable dmalloc... no

checking whether to enable IPv6 support... yes

checking whether to enable DTrace support... no

checking how big to make fd sets... using system default

Configuring extensions

checking size of long... (cached) 

checking size of int... (cached) 

checking for int32_t... yes

checking for uint32_t... yes

checking for sys/types.h... (cached) yes

checking for inttypes.h... (cached) yes

checking for stdint.h... (cached) yes

checking for string.h... (cached) yes

checking for stdlib.h... (cached) yes

checking for strtoll... yes

checking for atoll... yes

checking for strftime... (cached) yes

checking which regex library to use... php

checking whether to enable LIBXML support... yes

checking libxml2 install dir... no

checking for xml2-config path...

configure: error: xml2-config not found. Please check your libxml2 installation.

报错“configure: error: xml2-config not found. Please check your libxml2 installation.”是因为缺少libxml2相关的包libxml2-devel, 如下所示,先检查已经安装了那些libxml2相关的包

Code Snippet
  1. [root@getlnx05 php-5.4.10]#  rpm -qa |greplibxml2
  2. libxml2-python-2.6.26-2.1.12
  3. libxml2-2.6.26-2.1.12
  4. libxml2-2.6.26-2.1.12

[root@getlnx05 php-5.4.10]# rpm -qa libxml2-devel

[root@getlnx05 php-5.4.10]# yum install libxml2-devel

[root@getlnx05 php-5.4.10]#  ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs

[root@getlnx05 php-5.4.10]#make

[root@getlnx05 php-5.4.10]#make install

接下来配置Apache服务,关于Apache的安装,可以参考我的博客Linux系统安装Appach 2.4.6

PHP环境配置

Step 1: Apache环境配置

首先找到Apache的配置文件配置文件/usr/local/apache/conf/httpd.conf (我Apache服务安装目录为/usr/local/apache)

找到

#User daemon

#Group daemon

修改为

User nagios

Group nagios

另外找到ServerName www.example.com:80 ,在下面增加ServerName添加服务器的IP地址

另外找到下面配置,增加index.php

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

接下来找到<IfModule mime_module>,在后面增加配置信息AddType application/x-httpd-php .php,如下所示

出于安全考虑,一般访问nagios的安全监控界面必须经过授权才能访问(不要那么,安装配置PHP是安装配置nagios的过程,如果大家只是为了安装配置PHP环境,完全可以跳过下面),这需要增加验证配置,即在httpd.conf 文件最后添加如下信息:

Step 2:创建apache目录验证文件

[root@getlnx05 conf]#  /usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd kerry

这样就在/usr/local/nagios/etc 目录下创建了一个htpasswd 验证文件,当通过http://192.168.xx.xxx/nagios/ 访问时就需要输入用户名和密码了。当然验证文件的密码是加密过的,如下所示:

[root@getlnx05 conf]# cat /usr/local/nagios/etc/htpasswd

kerry:$apr1$H1bHFvhH$q.bsSARuh4Ns2Z5G9hmQN.

[root@getlnx05 conf]#

Step 3:重启Apache服务

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

AH00526: Syntax error on line 515 of /usr/local/apache/conf/httpd.conf:

AuthUserFile takes one argument, text file containing user IDs and passwords

[root@getlnx05 conf]#

用vi打开/usr/local/apache/conf/httpd.conf文件,定位到515行(下面红色的哪一行),后面的哪一行汉字注释变成导致,如下图所示:

Code Snippet
  1. #setting for nagios
  2. ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
  3. <Directory "/usr/local/nagios/sbin">
  4. AuthType Basic
  5. Options ExecCGI
  6. AllowOverride None
  7. Order allow,deny
  8. Allow from all
  9. AuthName "Nagios Access"
  10. AuthUserFile /usr/local/nagios/etc/htpasswd //用于此目录访问身份验证的文件
  11. Require valid-user
  12. </Directory>
  13. Alias /nagios "/usr/local/nagios/share"
  14. <Directory "/usr/local/nagios/share">
  15. AuthType Basic
  16. Options None
  17. AllowOverride None
  18. Order allow,deny
  19. Allow from all
  20. AuthName "nagios Access"
  21. AuthUserFile /usr/local/nagios/etc/htpasswd
  22. Require valid-user
  23. </Directory>

将这一行注释清除后,重启Apache服务,OK,问题解决,打开http://192.168.7.223/nagios/进入网站,点击其它页面发现乱码,这是因为Apache没有开启cgi脚本的缘故。进入apache的主配置文件httpd.conf将#LoadModule cgid_module modules/mod_cgid.so前的注释符号去掉,重启Apache服务即可解决问题

参考资料:

http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html

Redhat Server 5.7 安装配置PHP的更多相关文章

  1. CentOS6.0/RedHat Server 6.4安装配置过程 详细图解!

    1.准备安装 1.1 系统简介 CentOS 是什么? CentOS是一个基于Red Hat 企业级 Linux 提供的可自由使用的源代码企业级的 Linux 发行版本.每个版本的 CentOS 都会 ...

  2. ubuntu14.04 server ftp 服务安装配置详解

    ubuntu14.04 server ftp 服务安装配置详解 cheungmine 2016-01-27 http://wiki.ubuntu.com.cn/Vsftpd 0 安装好vsftpd服务 ...

  3. Ubuntu Server 13.10 安装配置图解教程

    一.Ubuntu Server 13.10系统安装 Ubuntu分为桌面版(desktop)和服务器版(Server),下面为大家介绍服务器版本Ubuntu Server 13.10的详细安装过程. ...

  4. windows server 2008R2 上安装配置freesshd

    从FREESSHD官方网站下载最新的软件版本,下载地址是http://www.freesshd.com/?ctt=download 双击刚刚下载的freeSSHd.exe进行安装,安装时其他都是默认安 ...

  5. ubuntu 12.04 server + OPENACS(TR069)安装配置日记

    1. 有两个叫openacs的, openacs.org下的不是 2. 严格匹配版本:luo@bogon:~$ ls jboss-4.2.3.GA-jdk6.zip  jdk-6u41-linux-i ...

  6. Team Foundation Server 2010下载安装配置方法

    一.Team Foundation Server 2010下载: ed2k://|file|cn_visual_studio_team_foundation_server_2010_x86_x64_d ...

  7. Nagios在Ubuntu server上的安装配置

    首先我参看的是Nagios的官方文档,Nagios – Installing Nagios Core From Source——The Industry Standard in IT Infrastr ...

  8. Weblogic Server 的下载,安装配置与部署

    下载 下载页面: http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html 目前 ...

  9. windows server,nginx安装,配置,运行nodeJS后端的web项目的实现,以及错误分析及解决方法

    一.安装nginx 下载windows版nginx (http://nginx.org/download/nginx-1.12.2.zip),之后解压到需要放置的位置(C:\nginx) 二.将Ngi ...

随机推荐

  1. 微服务实战(二):使用API Gateway--转

    原文地址:http://dockone.io/article/482 [编者的话]本系列的第一篇介绍了微服务架构模式.它讨论了采用微服务的优点和缺点,除了一些复杂的微服务,这种模式还是复杂应用的理想选 ...

  2. DB2 Enterprise Server Edition(DB2 ESE)9.1在Windows Server 2008 下出现无法新建数据库的情况,及解决办法

    在安装有,DB2 9.1版本的Windows Server 2008 上面,使用默认的安装方式导致无法创建数据库,相关的错误提示: "SQL3012C 发生系统错误(原因码= "& ...

  3. Oracle OCP 1Z0-053 Exam Topics

    根据OU官方发布的考试大纲,OCP 1Z0-053考点如下: 1. Database Architecture and ASM Describe Automatic Storage Managemen ...

  4. WebGIS中基于AGS的画圆查询简析以及通过Polygon来构造圆的算法

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/. 1.背景 某个项目需求中需要在前端进行画圆查询,将圆范围上的多边形要素 ...

  5. 使用Microsoft Roslyn提取C#和VB.NET源代码中的字符串常量

    Microsoft Roslyn是微软.NET“编译器即服务(Compiler as a Service)”的主要产品,它提供了开放的编译器API,并为源代码产生.分析和重构提供了新一代的语言对象模型 ...

  6. jQuery-1.9.1源码分析系列(三) Sizzle选择器引擎——总结与性能分析

    Sizzle引擎的主体部分已经分析完毕了,今天为这部分划一个句号. a. Sizzle解析流程总结 是时候该做一个总结了.Sizzle解析的流程已经一目了然了. 1.选择器进入Sizzle( sele ...

  7. Repeater 控件

    Repeater 控件是一个容器控件,可用于从网页的任何可用数据中创建自定义列表.Repeater 控件没有自己内置的呈现功能,这意味着用户必须通过创建模板来提供 Repeater 控件的布局.当网页 ...

  8. android 网络加载图片,对图片资源进行优化,并且实现内存双缓存 + 磁盘缓存

    经常会用到 网络文件 比如查看大图片数据 资源优化的问题,当然用开源的项目  Android-Universal-Image-Loader  或者 ignition 都是个很好的选择. 在这里把原来 ...

  9. Java中, 函数的调用、随机数字

    函数:     独立完成某个功能的代码模块.(方法) 作用是为了让代码结构更加良好.模块清晰,实现重用. 函数的四要素:名称,输入值,加工过程,返回值 Java中函数的语法 static 返回类型 函 ...

  10. VGA colorbar显示

    module VGAcolorbar(clk,rst,hsync,vsync,vga_r,vga_g,vga_b ); input clk; input rst; output hsync; outp ...