ubuntu18 安装apache2.4 php5.6 mysql5.6

 

源码包下载:

链接:https://pan.baidu.com/s/1uoVMy_QNyR_zqVi06QPqKg
提取码:ll7s

注意:
    ubuntu安装:sudo apt-get install gcc build-essential(这个是c++编译环境)
    当apr_xml.c报错尝试 sudo apt-get install libexpat1-dev

    解压 tar -zxf xx.tar.gz  tar -xf xx.tar

    ./configure 配置完后使用 sudo make && sudo make install 编译安装



1、安装编译环境
    sudo apt-get install gcc build-essential libexpat1-dev -y

2、安装pcre
    ./configure --prefix=/usr/local/pcre

3、安装apr apr-util
    ./configure --prefix=/usr/local/apr
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

4、安装apache
    ./configure --prefix=/usr/local/apache2 --enable-so --disable-env --enable-rewrite --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

5、安装linxml2
    sudo apt-get install libxml2* -y

6、安装php
    ./configure --prefix=/usr/local/php5.6 --bindir=/usr/local/bin --sbindir=/usr/local/sbin --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5.6/etc --with-mysql --with-pdo-mysql

    php需要配置apxs 来支持apache(httpd-devel),apache1.x 使用--with-apxs,2.x使用--with-apxs2

7、配置php

    sudo cp php.ini-development /usr/local/php5.6/etc/php.ini

8、配置apache

    sudo vim /usr/local/apache2/conf/httpd.conf

        LoadModule php5_module        modules/libphp5.so

        配置完apxs默认已经挂在了libphp5.so ,只需要让他解析就ok

         DocumentRoot "/var/www/html"
         <Directory "/var/www/html">
   默认网站根在apache目录下htdocs目录中。这里我改成了/var/www/html
        <IfModule dir_module>
                DirectoryIndex index.html index.php home.php default.php
        </IfModule>
        默认加载的网站文件
        然后在<IfModule mime_module>里面添加解析php文件
            AddType application/x-compress .Z
            AddType application/x-gzip .gz .tgz
            AddType application/x-httpd-php .php .phtml
        # Virtual hosts
        Include conf/extra/httpd-vhosts.conf
  支持虚拟主机功能。然后需要先去conf/extra/httpd-vhosts.conf原有的条目屏蔽掉,改成自己的。
9、安装mysql

    tar -xf xxx.tar

    sudo dpkg -i mysql*

    sudo apt-get install -f

    输入mysql密码

  配置文件:/etc/myslq/my.cnf

 

posted @ 2018-12-09 15:15  ashe666  阅读(1604)  评论(0编辑  收藏  举报