zoukankan      html  css  js  c++  java
  • LAMP源码安装

    1.1 安装apache

    apache历史版本下载地址:点击这里
    apr下载地址:点击这里
    源码安装LAMP环境

    1.1.1 下载软件:

    个人习惯/server/tools 软件包目录
    $ wget https://archive.apache.org/dist/httpd/httpd-2.4.33.tar.gz
    $ wget http://www.apache.org/dist/apr/apr-1.6.5.tar.gz
    $ wget http://www.apache.org/dist/apr/apr-util-1.6.1.tar.gz
    

    1.1.2.编译安装apr

    $ tar xf apr-1.6.5.tar.gz
    $ cd apr-1.6.5/
    $ ./configure --prefix=/usr/local/apr
    $ make
    $ make install
    

    1.1.3 编译安装util

    $ tar xf apr-util-1.6.1.tar.gz
    $ cd apr-util-1.6.1/
    $ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    $ make
    $ make install
    

    1.1.4 安装httpd

    1.1.4.1 安装依赖

    $ yum -y install pcre-devel zlib zlib-devel
    
    $ tar xf httpd-2.4.33.tar.gz 
    $ cd httpd-2.4.33/
    ./configure 
    --prefix=/application/httpd-2.4.33 
    --with-apr=/usr/local/apr 
    --with-apr-util=/usr/local/apr-util 
    --enable-module=so 
    --enable-deflate=shared 
    --enable-expires=shared 
    --enable-rewrite=shared 
    --enable-cache 
    --enable-file-cache 
    --enable-mem-cache 
    --enable-disk-cache 
    --enable-static-support 
    --enable-static-ab 
    --disable-userdir 
    --with-mpm=worker 
    --enable-nonportable-atomics 
    --disable-ipv6 
    --with-sendfile
    $ make
    $ make install
    

    1.1.4.2 检查语法(在httpd的安装位置路径bin下执行此命令,也可设置环境变量)

    $ ./apachectl -t
    
    1.1.4.3 启动
    $ ./apachectl -k start
    

    1.1.4.4 查看编译的模块

    $ ./apachectl -l
    $ ./apachectl -M
    

    1.2 PHP安装

    1.2.1 安装依赖

    yum install -y zlib libjpeg freetype libpng gd curl zlib-devel libxml2-devel 
    yum -y install libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel 
    yum -y install libjpeg-turbo-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mcrypt
    

    1.2.2 下载php

    php-5.5.38

    $ tar xf php-5.5.38.tar.gz
    $ cd php-5.5.38/
    ./configure 
    --prefix=/application/php-5.5.38 
    --enable-mysqlnd 
    --with-mysql=mysqlnd 
    --with-mysqli=mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-freetype-dir 
    --with-jpeg-dir 
    --with-png-dir 
    --with-zlib 
    --with-libxml-dir=/usr 
    --enable-xml 
    --disable-rpath 
    --enable-bcmath 
    --enable-shmop 
    --enable-sysvsem 
    --enable-inline-optimization 
    --with-curl 
    --enable-mbregex 
    --enable-mbstring 
    --with-mcrypt 
    --with-gd 
    --with-gettext 
    --enable-gd-native-ttf 
    --with-openssl 
    --with-mhash 
    --enable-pcntl 
    --enable-sockets 
    --with-xmlrpc 
    --enable-zip 
    --enable-soap 
    --enable-short-tags 
    --enable-static 
    --with-xsl 
    --enable-fpm 
    --with-fpm-user=www 
    --with-fpm-group=www 
    --enable-opcache=no  
    --enable-ftp 
    --with-apxs2=/application/httpd-2.4.33/bin/apxs
    $ make
    $ make install
    

    1.2.3 复制解释器配置文件

    cp /server/tools/php-5.5.38/php.ini-production /application/php-5.5.38/lib/php.ini
    

    1.2.4 配置apache支持php

    echo "LoadModule php5_module   modules/libphp5.so" >>/application/httpd-2.4.33/conf/httpd.conf
    

    1.2.5 添加php首页文件

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

    1.2.6 添加php应用类型

    <IfModule mime_module>
        TypesConfig conf/mime.types
        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz
        AddType application/x-httpd-php .php
    </IfModule>
    

    1.2.7 php测试文件

    $ vim /application/httpd/htdocs/index.php 
    <?php
    phpinfo();
    ?>
    

    1.2.8 重启apache网页访问ip即可

    1.3 安装数据库

    $ yum -y install mariadb mariadb-server
    

    1.3.1 进入mysql创建用户并授权

    $ mysql
    mysql>create database bbs;
    mysql>grant all on bbs.* to bbs@'172.17.9.%' identified by '123456';
    

    1.3.2 测试MySQL中的bbs用户登录

    $ mysql -h 172.17.9.75 -ubbs -p123456
    

    1.3.3 测试php连接MySQL

    $ vim /application/httpd-2.4.33/htdocs/php_mysql.php 
    <?php
            //$link_id=mysql_connect('主机名','用户','密码');
            $link_id=mysql_connect('172.17.9.75','bbs','123456') or mysql_error();
            if($link_id){
                    echo "mysql successful by wordpress !
    ";
            }else{
                    echo "mysql_error()";
    
            }
    

    代表正常

  • 相关阅读:
    【西北师大-18软工】第七次作业成绩汇总
    【西北师大-18软工】第六次作业成绩汇总
    【西北师大-18软工】第五次作业成绩汇总
    【西北师大-18软工】第四次作业成绩汇总
    使用jQuery刷新页面
    jquery怎么判断浏览器是否是ie
    JavaScript如何生成随机字母数字字符串
    js如何引入css文件
    提高网站加载速度的提示和小技巧
    JavaScript 9 个功能强大的技巧
  • 原文地址:https://www.cnblogs.com/blsnt/p/10184150.html
Copyright © 2011-2022 走看看