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. Huffman编码

    #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstri ...

  2. Zookeeper-Zookeeper可以干什么

    在Zookeeper的官网上有这么一句话:ZooKeeper is a centralized service for maintaining configuration information, n ...

  3. MBProgressHud添加自定义动画

    在使用自定义view时,若直接使用,如下 MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud ...

  4. C# mvc DropDownList选中状态无效情况分析

    情况: DropDownList控件使用List<SelectListItem>()设置下拉选项和默认值.当控件的Name和后台的ViewBag(或ViewData)的Key重复,会导致选 ...

  5. visul studio 文件分包

    1.搜索算法. 2.软件控制逻辑. 3.自定义控件. 4.GUI模块. 5.线程化操作

  6. REST有状态与无状态的理解

    1. 什么是REST? REST(REpresentation State Transfer)表述性状态传递,是一种软件架构风格,是一种针对网络应用的设计和开发方式,可以降低开发的复杂性,提高系统的可 ...

  7. Linux Oracle删除归档日志

    今天遇到Oracle报这样的错:ORA-00257 查看了下,原来是Oracle的归档日志满了,解决方案两个 一:增加归档日志大小 二:删除无用的归档日志(我们选择这个方案) 什么也不说了Linux下 ...

  8. JS 获取FileUpload1控件地址

    function openList() { //判断浏览器类型 var isIE = (document.all) ? true : false; ); ); ); var path = " ...

  9. vim的批量注释与删除注释

    vim的批量注释与删除注释 方法一:块选择模式 批量注释: Ctrl + v 进入块选择模式,然后移动光标选中你要注释的行,再按大写的I进入行首插入模式输入注释符号如 // 或 #,输入完毕之后,Vi ...

  10. Codeforces Round #347 (Div. 2) (练习)

    A: 题意:找到[a, b]的最大公约数: 思路:相同时为本身,不同时为1. 套路:碰到水题别想太多: 猜想:两个相邻数,必有一奇一偶,如果偶数有因子3或者其他,奇数可不可能有相同的呢? 枚举一些数后 ...