安装库文件

yum install -y pcre pcre-devel apr apr-deve

安装apache

cd /usr/local/src/httpd-2.4.23

Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.5.2.tar.gz

wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.gz

[root@a src]# tar -zxf apr-1.5.2.tar.gz -C httpd-2.4.23/srclib/
[root@a src]# tar -zxf apr-util-1.5.4.tar.gz -C httpd-2.4.23/srclib/

[root@a srclib]# mv apr-1.5.2/ apr
[root@a srclib]# mv apr-util-1.5.4/ apr-util

./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --with-pcre

configure: error: in `/usr/local/src/httpd-2.4.23/srclib/apr':
configure: error: no acceptable C compiler found in $PATH

#安装gcc

yum -y install gcc

#重新编译

mod_deflate has been requested but can not be built due to prerequisite failures

#安装

yum install  zlib-devel openssl-devel

#重新编译,编译通过

make && make install

##安装php

wget http://cn2.php.net/get/php-5.6.28.tar.gz/from/this/mirror

#依赖包安装,可以在apache安装前进行安装

yum  install  -y  gcc  gcc-c++    make  zlib  zlib-devel  pcre  pcre-devel    libjpeg  libjpeg-devel  libpng  libpng-devel  freetype  freetype-devel  libxml2  libxml2-devel  glibc  glibc-devel  glib2  glib2-devel  bzip2  bzip2-devel  ncurses  ncurses-devel  curl  curl-devel    openssl  openssl-devel gd gd-devel libicu libicu-devel autoconf libevent libevent-devel   libmcrypt libmcrypt-devel
#安装
 

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6  --enable-bcmath

## php-7   --with-pdo-mysql 

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
#安装

wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

tar –xzf libmcrypt-2.5.8.tar.gz

[root@a libmcrypt-2.5.8]# ./configure

make && make install

#重新编译php

error: Cannot find libmysqlclient_r under /usr/local/mysql.

ln -s libmysqlclient.so.20.3.3 libmysqlclient_r.so  (mysql5.7.16)

#编译动过

make && make install

apache与php结合

vim /usr/local/apache2/conf/httpd.conf
#找到
AddType application/x-gzip .gz .tgz
#在下面添加
AddType application/x-httpd-php .php

#找到

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
#修改

<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>

#

#ServerName www.example.com:80
#修改

#测试lamp是否安装成

#检验配置文件是否正确

[root@a conf]# /usr/local/apache2/bin/apachectl -t
Syntax OK
#启动apache

/usr/local/apache2/bin/apachectl  start

#查看是否启动

[root@a conf]# netstat -lnp |grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      80644/httpd

[root@a conf]# curl localhost
<html><body><h1>It works!</h1></body></html>

#php测试

[root@a htdocs]# vim 1.php

<?php
echo "php解析正常";
?>
 

[root@a htdocs]# curl localhost/1.php
php解析正常

apache与php安装的更多相关文章

  1. Apache的详细安装教程和遇到的问题解决方案

    Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一 (一)Apache安装软件下载 1.访问 ...

  2. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...

  3. Apache HTTP Server安装教程

    Apache HTTP Server安装教程 Apache HTTP Server的官方网站是:http://httpd.apache.org/,可以从中下载最新版本的Apache HTTP Serv ...

  4. RHEL7下PXE+Apache+Kickstart无人值守安装操作系统

    RHEL7下PXE+Apache+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] na ...

  5. Windows 下 Apache HTTP Server 安装、配置以及与 Tomcat 的整合(附图)

    如果您能点开这篇文章,说明您已对熟悉Apache HTTP Server(下文用Apache简称)配置的重要性已很清楚了,本文不在赘述,直接介入正题,请往下阅读: 为便于阅读,列出文章目录: 一.Ap ...

  6. apache+php+mysql安装与使用

    偷个懒,用的系统自带的apache和php apache安装与使用 Mac自带apache默认路径 主程序 /usr/sbin/httpd 模块 /usr/libexec/apache2 配置 /et ...

  7. 【Apache】Apache服务的安装(一)

    Apache简介 Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行 ...

  8. linux apache+php+mysql安装及乱码解决办法

    1.乱码解决方法 首先确认mysql数据库字符集设置正确,php页面字符设置正确,之后修改apache配制文件http.conf 注释掉以下字符 AddDefaultCharset UTF-8 此为乱 ...

  9. CentOS 7 Apache服务的安装与配置

    原文出处:http://blog.51cto.com/13525470/2070375 一.Apache简介 Apache 是一个知名的开源Web服务器.早期的Apache服务器由Apache Gro ...

  10. Apache Derby数据库 安装、知识点

    Apache Derby数据库 安装: 下载路径:http://archive.apache.org/dist/db/derby/ 出处:http://www.yiibai.com/hive/hive ...

随机推荐

  1. eclipse 安卓运行一直跳转到调试模式

    最直接的办法,换手机试试,如果在其他手机上能run,那就重启手机即可 感觉写这么一点点似乎不足以发表一篇博客,给个链接吧:http://www.itnose.net/detail/6103213.ht ...

  2. cshtml一二

    布局页:_MyLayout.cshtml <!DOCTYPE html> @*Razor布局页*@ <html> <head> @*HTTP的头部协议,提示浏览器网 ...

  3. ElasticSearch(8)-分布式搜索

    分布式搜索的执行方式 在继续之前,我们将绕道讲一下搜索是如何在分布式环境中执行的. 它比我们之前讲的基础的增删改查(create-read-update-delete ,CRUD)请求要复杂一些. 注 ...

  4. 顶层const和底层const

    As we’ve seen, a pointer is an object that can point to a different object. As a result,we can talk ...

  5. libimobiledevice命令

    Mac 安装 1. 安装HomeBrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/m ...

  6. MPlayerX播放视频屏幕中间有图标遮挡的解决办法

    问题如下: 解决办法: 在应用程序文件夹中找到MPlayerX,鼠标右击应用图标,在右键菜单中选择"显示包内容",进入如下目录:Contents->Resources,找到l ...

  7. 转:条件变量、pthread_cond_init

    1.初始化条件变量pthread_cond_init #include <pthread.h>int pthread_cond_init(pthread_cond_t *cv,const ...

  8. supervisor笔记

    supervisord 作为主进程,管理旗下的各个子进程,子进程会产生若干线程.当某个管理的服务异常奔溃之后,supervisor 会自动重启该服务.配合使用 superlance 插件以实现 Htt ...

  9. hdu1008

    //c++// #includeusing namespace std;int main(){int n,j,t,start;while (cin >> n,n){start =0;t = ...

  10. bootstrap复习:全局样式

    一.概览 1.Bootstrap 是移动设备优先的. 2.在移动设备浏览器上,通过为视口(viewport)设置 meta 属性为 user-scalable=no 可以禁用其缩放(zooming)功 ...