centos 安装 php5.6,安装前需要先安装数据库和apache

安装 apache2.4

安装基础依赖:
# yum install gcc gcc-c++ glibc glibc-devel gd gd-devel zlib zlib-devel libtool-ltdl-devel flex autoconf automake

apache 需要依赖apr 和 apr-util、apr-iconv、pcre

所以还需要先安装 apr和apr-util、apr-iconv
# wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz
# wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz
# wget http://apache.fayea.com//apr/apr-iconv-1.2.1.tar.gz
# wget https://sourceforge.net/projects/pcre/files/pcre/7.9/pcre-7.9.zip
#
# tar xzvf apr-1.5.2.tar.gz
# tar xzvf apr-util-1.5.4.tar.gz
# tar xzvf apr-iconv-1.2.1.tar.gz
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..
# cd apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make insatll
# cd ..
# cd apr-iconv-1.2.1
# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
# make
# make insatll
#
# 安装pcre
# unzip pcre-7.9.zip
# cd pcre-7.9
# ./configure --prefix=/usr/local/pcre
# make && make install

apache历史版本下载地址:
# wget http://archive.apache.org/dist/httpd/httpd-2.4.9.tar.gz

# tar xzvf httpd-2.4.9.tar.gz
# cd httpd-2.4.9
# ./configure --prefix=/usr/local/apache --enable-track-vars --enable-cgi --enable-proxy-fcgi  --with-config-file-path=/usr/local/apache/conf --with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
# make
# make install

说明:enable-cgi 支持CGI;enable-track-vars 为启动cookie的get/post等追踪功能

将apache安装为系统服务

# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

# service httpd start

安装php5.6

下载:
# wget http://cn2.php.net/distributions/php-5.6.25.tar.bz2
解压
# bunzip2 php-5.6.25.tar.bz2
# tar xvf php-5.6.25.tar
#
# cd php-5.6.25
# ./configure --prefix=/usr/local/php5.6 \
--with-libxml-dir=/usr/include/libxml2 --with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/apache/conf \
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --enable-gd-native-ttf \
--with-zlib --with-mcrypt --with-pdo-mysql=/usr/local/mysql --enable-shmop \
--enable-soap --enable-sockets --enable-wddx --enable-zip --with-xmlrpc \
--enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif \
--enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib \
--with-freetype-dir=/usr/lib/ --with-pgsql=/usr/local/pgsql --with-pdo-pgsql=/usr/local/pgsql

注意引用的相关数据库和工具的路径,不然编译会报错误,编译引入了apache,是因为要支持使用apache服务器,需要先安装apache

其中 --with-config-file-path表示php.ini的配置文件路径, --with-apxs2 标识编译apache2的链接为共享Handler模式。

# make
# make install

建议修改一下php的时间格式,默认是美国时间
修改php.ini文件:
date.timezone = Asia/Shanghai

php5.6安装完毕

修改httpd.conf配置文件
1. 添加php支持。
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
2. 添加默认索引页面index.php,再找到“DirectoryIndex”,在index.html后面加上“ index.php”
DirectoryIndex index.html index.php
3. 不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为
Options FollowSymLinks
4. 开启Apache支持伪静态,找到“AllowOverride None”,修改为
AllowOverride All

重启apache服务即可。

创建一个php文件测试看能否显示php信息

<?
phpinfo();

centos 安装apache 和 php5.6的更多相关文章

  1. centos 7.2 安装apache,mysql,php5.6

    安装Apache.PHP.Mysql.连接Mysql数据库的包: yum -y install httpd yum -y install php yum -y install php-fpm yum  ...

  2. centos安装apache

    查询是否已安装apache:  rpm -qa httpd 安装apache: yum install httpd -y 查询: chkconfig httpd on 启动: service http ...

  3. CentOS 安装apache 及所需的 apr,apr-util,pcre

    安装apache前确定已安装 apr,apr-util,pcre 一.安装apr [root@xt test]# tar -zxf apr-1.4.5.tar.gz [root@xt test]# c ...

  4. CentOS 安装apache

    yum 安装apache yum –y install httpd 设置开机启动 chkconfig --levels 235 httpd on 启动 /etc/init.d/httpd start ...

  5. 阿里云 centos 安装apache和php

    mysql使用阿里云的rds httpd服务 1. 安装apr和apr-util 2. 安装 httpd apache.org,apr.apache.org 安装命令: ./configure --p ...

  6. [部署]CentOS安装apache

    环境 虚拟机:VMWare10.0.1 build-1379776 操作系统:CentOS7 64位 步骤 1.使用yum安装 yum install httpd httpd-devel 2.启动 a ...

  7. centos 安装apache activemq

    安装说明 安装环境:CentOS-6.3 安装方式:源码安装  软件:apache-tomcat-7.0.29.tar.gz下载地址http://activemq.apache.org/downloa ...

  8. Centos 安装Apache软件

    检查rpm    -qa    httpd [root@luozhonghua icons]# rpm    -qa   |grep  httpd httpd-2.2.15-30.el6.centos ...

  9. Centos 安装旧版php5.2

    # yum remove php-* # cd /root/ && mkdir new_php && cd new_php # wget -r http://yum.m ...

随机推荐

  1. C/C++ 记录时间

    http://stackoverflow.com/questions/2808398/easily-measure-elapsed-time https://github.com/picanumber ...

  2. Checkpoints codeforces 709B

    http://codeforces.com/problemset/problem/709/B 题意:给出一条横向坐标轴,给出Vasya所在的坐标位置及其另外n个坐标.Vasya想要至少访问n-1个位置 ...

  3. JavaScript 详说事件机制之冒泡、捕获、传播、委托

    DOM事件流(event  flow )存在三个阶段:事件捕获阶段.处于目标阶段.事件冒泡阶段. 事件捕获(event  capturing):通俗的理解就是,当鼠标点击或者触发dom事件时,浏览器会 ...

  4. java多线程详解(1)-多线程入门

    一.多线程的概念 线程概念 线程就是程序中单独顺序的流控制. 线程本身不能运行,它只能用于程序中. 说明:线程是程序内的顺序控制流,只能使用分配给程序的资源和环境. 进程:操作系统中执行的程序 程序是 ...

  5. CMakeLists for tesseract

    在网上找了很多,直接用都不行,试了半天的到以下的结果. cmake_minimum_required(VERSION 2.8) project( test ) include_directories ...

  6. null 和 NULL 判断

    遇到问题,服务器传回 null,我擦嘞,接收不了. 解决如下: NULL 直接 判断就好,能在 xcode 上直接敲出 null 的话  可以  ==[NSNull class] 或者[respons ...

  7. keepalived高可用

    keepalived介绍 Keepalived是一个基于vrrp协议的高可用方案,vrrp协议的软件实现,原生设计的目的为了高可用ipvs服务. 1. vrrp协议 VRRP是一种容错协议,它通过把几 ...

  8. windows下远程桌面连接centos

    最近,由于项目需要,必须要在centos下进行操作.习惯了图形界面的我,通过黑框框来远程操作服务器,着实让人难受.但是,windows自带的远程桌面工具貌似不能直接连centos.所以,只能借助其他工 ...

  9. 快速排序 - C语言

    看了这本<数据结构与算法分析>中的快速排序. 写下自己理解后的代码,以备后用. #include "stdio.h" void insertSort(int arr[] ...

  10. Golang 文件服务器小结

    花了一个星期学习文件服务器,老是在一些地方搞混,整理一下所学的,清晰了不少. 学Go半个月,还有很多不懂的地方,有理解错误的,还望高手指出. 注:以下代码中,w为http.ResponseWriter ...