编译httpd、php+通用二进制mysql搭建phpMyadmin环境

编译安装httpd:http://my.oschina.net/forlinux/blog/362617

通用二进制安装mysql:http://my.oschina.net/forlinux/blog/362335

1.说明

本篇博客将php编译为httpd的模块,运行phpMyadmin管理mysql

2.安装包

php-5.4.31.tar.bz2、mysql-5.6.22-linux-glibc2.5-x86_64.tar.gz、phpMyAdmin-4.2.13.1-all-languages.zip

3.编译前准备

3.1添加yum源

[root@Machine1 ~]# vim /etc/yum.repos.d/ali.repo 
[root@Machine1 ~]# cat /etc/yum.repos.d/ali.repo 
[epel]
name=aliyun epel
baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-6
[root@Machine1 ~]# yum repolist
Loaded plugins: security
repo id                                     repo name                                                                  status
base                                        CentOS-6 - Base                                                             6,518
epel                                        aliyun epel                                                                11,154
extras                                      CentOS-6 - Extras                                                              36
openlogic                                   CentOS-6 - openlogic packages for x86_64                                       32
updates                                     CentOS-6 - Updates                                                            530
repolist: 18,270

3.2安装编译php所依赖的软件

[root@Machine1 ~]# yum -y install libxml2-devel bzip2-devel \
>libmcrypt-devel mhash-devel php-mbstring

4.编译php

[root@Machine1 php-5.4.31]# ./configure \
>--prefix=/usr/local/php \
>--with-mysql=/usr/local/mysql \
>--with-mysqli=/usr/local/mysql/bin/mysql_config \
>--with-openssl \
>--enable-mbstring \
>--with-freetype-dir \
>--with-jpeg-dir \
>--with-png-dir \
>--with-zlib \
>--with-libxml-dir=/usr \
>--enable-xml \
>--enable-sockets \
>--with-apxs2=/usr/local/httpd/bin/apxs \
>--with-mcrypt \
>--with-config-file-path=/etc \
>--with-config-file-scan-dir=/etc/php.d \
>--with-bz2 \
>--enable-maintainer-zts

  • --prefix=PATH                            #安装路径

    --with-mysql                              #php连接mysql的驱动

    --with-mysqli                             #mysql的高级接口,一般必须指定

    --with-apxs2                              # php要想编译成httpd的模块,必须基于此接口编译

    --with-config-file-path               #php的主配置文件路径

    --with-config-file-scan-dir          #其他配置文件,次路径下所有.ini的文件都识别为配置文件的一部分

    --enable-maintainer-zts              #当httpd使用worker、event模型时,php需要编译为此格式

[root@Machine1 php-5.4.31]# make && make install
[root@Machine1 php-5.4.31]#cp php.ini-production /etc/php.ini

修改主配置文件:

主配置文件中添加AddType application/x-httpd-php .php

但是有的php网页文件是以.phps结尾,所以再添加一行AddType application/x-httpd-php-source .phps

还需要让httpd知道默认主页面DirectoryIndex index.php

测试:

[root@Machine1 php-5.4.31]# vim /usr/local/httpd/htdocs/index.php

    <?php

         phpinfo();

    ?>

QQ截图20150104161035

[root@Machine2 ~]vim /usr/local/httpd/htdocs/index.php
    <?php
        $link=mysql_connect(localhost,root,rootroot);
        if ($link)
            echo "Success...";
        else
            echo "Failure...";
    ?>

QQ截图20150104162208

5.运行phpMyadmin

[root@Machine1 ~]# unzip phpMyAdmin-4.3.1-all-languages.zip

[root@Machine1 ~]# cp -R phpMyAdmin-4.3.1-all-languages/* /usr/local/httpd/htdocs/

[root@Machine1 ~]#cd /usr/local/httpd/htdocs/

[root@Machine1 ~]# cp config.sample.inc.php config.inc.php

[root@Machine1 ~]#vim config.inc.php
$cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

QQ截图20150104163516

QQ截图20150104163616

转载于:https://my.oschina.net/forlinux/blog/362820

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值