设为首页 收藏本站
查看: 941|回复: 0

零起步7-CentOS6.3关于LAMP的配置apache-2.4.3、php-5.4.7、phpMyAdmin3.5

[复制链接]
累计签到:6 天
连续签到:1 天
发表于 2015-11-16 07:06:42 | 显示全部楼层 |阅读模式
全新以最小化包安装了64位的CentOS6.3系统,作为本地的Web服务器使用,现记录全过程第七步,LAMP配置,版本为httpd-2.4.3、php-5.4.7、phpMyAdmin3.4
准备工作,下载相应安装包[iyunv@localhost ~]# yum install wget -y[iyunv@localhost ~]# wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.4.3.tar.gz[iyunv@localhost ~]# wget http://mirrors.axint.net/apache/apr/apr-1.4.6.tar.gz[iyunv@localhost ~]# wget http://mirrors.axint.net/apache/apr/apr-util-1.5.1.tar.gz[iyunv@localhost ~]# wget http://cn2.php.net/distributions/php-5.4.7.tar.gz[iyunv@localhost ~]# wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz[iyunv@localhost ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz

安装apache,版本为httpd-2.4.3,之前apache2.2的编译安装方法对apache2.4有些不适应以上源码包全部用tar zxvf xxx.tar.gz解压缩,apache2.4官网文档地址为http://httpd.apache.org/docs/2.4/
安装apache依赖包pcre[iyunv@localhost ~]# cd /usr/software/pcre-8.31[iyunv@localhost ~]# ./configure --prefix=/usr/local/pcre[iyunv@localhost ~]# make && make install
更新openssl库,否则编译时会报openssl太旧[iyunv@localhost ~]# yum install openssl-devel[iyunv@localhost ~]# yum update openssl
将apr、apr-util移动到apache的srclib目录[iyunv@localhost ~]# mv /usr/software/apr-1.4.6 /usr/software/httpd-2.4.3/srclib/apr[iyunv@localhost ~]# mv /usr/software/apr-util-1.5.1 /usr/software/httpd-2.4.3/srclib/apr-util
编译安装,对编译参数不熟悉的,可以用./configure --help查看[iyunv@localhost ~]# cd /usr/software/httpd-2.4.3[iyunv@localhost ~]# ./configure --prefix=/usr/local/apache --enable-so --enable-deflate=shared --enable-ssl=shared--enable-expires=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support --with-included-apr --with-mpm=prefork --enable-cache --enable-file-cache --with-pcre=/usr/local/pcre[iyunv@localhost ~]# make && make install
配置开机自启动[iyunv@localhost ~]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd[iyunv@localhost ~]# vim /etc/init.d/httpd在#!/bin/sh 下面加上这两行,wq保存退出# chkconfig: 345 90 90
# description: Apache[iyunv@localhost ~]# chkconfig --add /etc/init.d/httpd[iyunv@localhost ~]# service httpd start
打开防火墙80、443端口[iyunv@localhost ~]# vim /etc/sysconfig/iptables加上以下现行,wq保存退出-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
[iyunv@localhost ~]# service iptables restart
修改httpd.conf文件,避免“AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using centos.huoba. Set the 'ServerName' directive globally to suppress this message”错误提示[iyunv@localhost ~]# vim /usr/local/apache/conf/httpd.conf找到“#ServerName www.example.com:80”,在下面加上这一行ServerName localhost:80
Apache至此已经完成安装,另附相关命令,以后会常用查看apache版本[iyunv@localhost ~]# /usr/local/apache/bin/httpd -v查看apache已编译安装的模块[iyunv@localhost ~]# /usr/local/apache/bin/httpd -M
接下去还有文章会提到安装postfix+cyrus-sasl+mysql+extmail+maildrop时还会提到suexec模块的编译配置

安装php,版本为php-5.4.7
安装php依赖包libmcrypt[iyunv@localhost ~]# cd /usr/software/libmcrypt-2.5.8[iyunv@localhost ~]# ./configure[iyunv@localhost ~]# make && make install
安装相关资源及图片依赖包[iyunv@localhost ~]# yum install bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype-devel -y以下错误都是跟上述包没安装有关Configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
yum install bzip2 bzip2-devel

Configure: error: Please reinstall the BZip2 distribution
yum install curl curl-devel

configure: error: jpeglib.h not found.
yum install libjpeg libjpeg-devel

configure: error: png.h not found.
yum install libpng libpng-devel

configure: error: freetype.h not found.
yum install freetype-devel

更多的常见编译错误,可以参考这篇文章:http://hi.baidu.com/susuper_/item/27c588dd7d57affc3dc2cb07
编译安装php,该编译方法默认添加的mysql支持,无需再配置[iyunv@localhost ~]# cd /usr/software/php-5.4.7[iyunv@localhost ~]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/include/libxml2 --with-config-file-path=/usr/local/apache/conf --with-mysql=/usr/local/mysql --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/[iyunv@localhost ~]# make && make install
php配置,编译安装时我的php.ini文件目录指向/usr/local/apache/conf[iyunv@localhost ~]# cp /usr/software/php-5.4.7/php.ini-production /usr/local/apache/conf/php.ini
apache配置文件httpd.conf相关修改[iyunv@localhost ~]# vim /usr/local/apache/conf/httpd.conf1. 添加php支持,在末尾处加下如下代码    # php_module Configuration
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps
    PHPIniDir "conf"
2. 添加默认索引页面index.php,再找到“DirectoryIndex”,在index.html后面加上“ index.php”    DirectoryIndex index.html index.php index.jsp3. 找到“#ServerName www.example.com:80”,在下面加上这一行    ServerName localhost:804. 不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为    Options FollowSymLinks5. 开启Apache支持伪静态,找到“AllowOverride None”,修改为    AllowOverride All
保存httpd.conf配置,然后再执行以下两行命令[iyunv@localhost ~]# chown -R nobody. /usr/local/apache/htdocs/[iyunv@localhost ~]# chmod -R 777 /usr/local/apache/htdocs/

PHP至此已经完成安装,另在mongodb篇会详细讲解mongodb的的php驱动安装,其中有phpize使用介绍,以后会常用phpize主要用来加载php扩展,使用phpize不用重新编译整个php,以加载mongodb的php驱动为例介绍一下phpize使用

phpMyAdmin配置使用,版本为phpMyAdmin-3.5.3-all-languages下载地址:http://www.phpmyadmin.net/home_page/downloads.php
将phpMyAdmin解压后移到/usr/local/apache/htdocs/目录下,并将目录名改为phpMyAdmin1. phpMyAdmin配置文件加载顺序说明    phpmyadmin3中默认首先加载libraries/config.default.php配置文件的内容,如果有/config.inc.php,就会在config.inc.php配置文件中找到相同的变量并覆盖2. phpMyAdmin配置文件说明    config.inc.php配置示例请参考/config.sample.inc.php3. 修改config.default.php配置[iyunv@localhost ~]#  vim /usr/local/apache/htdocs/phpMyAdmin/libraries/config.default.php    $cfg['Servers'][$i]['host'] = 'localhost';              //mysql服务器IP地址,本机为localhost    $cfg['Servers'][$i]['port'] = '';                           //mysql连接端口,默认3306时可以留空    $cfg['Servers'][$i]['extension'] = 'mysqli';          //mysql的连接扩展应该为mysqli    $cfg['Servers'][$i]['user'] = 'root';                     //mysql数据库用户名为root    $cfg['Servers'][$i]['password'] = '';                   //在此处填写mysql密码    $cfg['LoginCookieValidity'] = 14400;                //phpMyAdmin的cookie会话时长,默认为1440(即24分钟),修改为144004. 至此配置已全部结束,使用以下地址访问phpMyAdmin    http://192.168.0.21/phpMyAdmin/                  //其中192.168.0.21即为你服务器的IP地址

         版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-139639-1-1.html 上篇帖子: 安装Moodle2.2步骤--在LAMP环境(linux+apache+mysql+php) 下篇帖子: Openwrt上LAMP(Php、Mysql、Apache)的安装配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表