CentOS7.4_x64安裝Apache-2.4.33+php-5.6.38+xdebug+swoole+curl

1.安裝基礎包        
    # yum -y install gcc-c++ bzip2     
        
2.安裝Apache 2.4.33    
    2.1 安裝apr    
    # tar -zxvf apr-1.6.3.tar.gz    
    # cd apr-1.6.3    
    # ./configure  --prefix=/usr/local/apr    
    # make    
    # make install    
    # cd ..    
        
    2.2 安裝expat    
    # tar vxjf expat-2.2.3.tar.bz2    
    # cd expat-2.2.3    
    # ./configure  --prefix=/usr/local/expat    
    # make    
    # make install    
    # cd ..    
        
    2.3 安裝apr-util    
    # tar -zxvf apr-util-1.6.1.tar.gz     
    # cd apr-util-1.6.1    
    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --with-expat=/usr/local/expat    
    # make    
    # make install    
    # cd ..    
        
    2.4 安裝apr-iconv                
    # tar -zxvf apr-iconv-1.2.2.tar.gz                 
    # cd apr-iconv-1.2.2                
    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config                
    # make                
    # make install                
    # cd ..                

    2.5 安裝pcre    
    # tar -zxvf pcre-8.42.tar.gz    
    # cd pcre-8.42    
    # ./configure --prefix=/usr/local/pcre    
    # make    
    # make install    
    # cd ..    
        
    2.6 安裝openssl    
    # tar -zxvf openssl-1.0.2o.tar.gz    
    # cd openssl-1.0.2o     
    # ./config --prefix=/usr/local/openssl -fPIC no-gost
    # make    
    # make install    
    # cd ..    
    
    2.7 安裝httpd    
    # tar -zxvf httpd-2.4.33.tar.gz    
    # cd httpd.2.4.33    
    # ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl    
    # make    
    # make install    
    # cd ..    
    
    2.8 配置apache開機自啓
    # mkdir -p /var/www/html                
                    
    # cp /usr/local/apache/bin/apachectl /etc/init.d/httpd                
    # vi /etc/init.d/httpd                
        在#!/bin/sh後面加入下面兩行            
        # chkconfig:345 85 15            
        # description: Start and stops the Apache HTTP Server.            
                    
        :wq            
    # chmod +x /etc/init.d/httpd
            
    # chkconfig --add httpd                
                    
    # vim /usr/local/apache/conf/httpd.conf                
        追加            
        ServerName 127.0.0.1            
        修改            
        DocumentRoot "/var/www/html"            
        <Directory "/var/www/html">            
                    


3.安裝PHP 5.6.38        
    # yum -y install python-devel zlib-devel freetype-devel libpng-devel autoconf    
        
        Installed:                
          autoconf.noarch 0:2.69-11.el7               freetype-devel.x86_64 0:2.4.11-15.el7        libpng-devel.x86_64 2:1.5.13-7.el7_2                       
          python-devel.x86_64 0:2.7.5-69.el7_5        zlib-devel.x86_64 0:1.2.7-17.el7                            
                        
        Dependency Installed:                
          libpng.x86_64 2:1.5.13-7.el7_2                                 perl-Data-Dumper.x86_64 0:2.145-3.el7                                                
                        
        Dependency Updated:                
          freetype.x86_64 0:2.4.11-15.el7          openssl.x86_64 1:1.0.2k-12.el7               openssl-libs.x86_64 1:1.0.2k-12.el7                         
          python.x86_64 0:2.7.5-69.el7_5           python-libs.x86_64 0:2.7.5-69.el7_5                  
        
    3.1 安裝libxml2    
    # tar zxvf libxml2-2.9.7.tar.gz    
    # cd libxml2-2.9.7    
    # ./configure --prefix=/usr/local/libxml2    
    # make    
    # make install    
    # cd ..    
        
    3.2 安裝jpeg9    
    # tar zxvf jpegsrc.v9.tar.gz    
    # cd jpeg-9/    
    # ./configure --prefix=/usr/local/jpeg9    
    # make    
    # make install    
    # cd ..    
        
    3.3 安裝libmcrypt    
    # tar -zxvf libmcrypt-2.5.8.tar.gz    
    # cd libmcrypt-2.5.8    
    # mkdir -p /usr/local/libmcrypt    
    # ./configure --prefix=/usr/local/libmcrypt/    
    # make    
    # make install    
    # cd ..    
        
    3.4 安裝GD    
    # tar -zxvf  gd-2.0.35.tar.gz    
    # cd gd-2.0.35    
    # mkdir -p /usr/local/gd    
    # ./configure --prefix=/usr/local/gd --enable-m4_pattern_allow --with-jpeg=/usr/local/jpeg9  --with-png --with-zlib --with-freetype --with-libmcrypt=/usr/local/libmcrypt    
    # make    
    # make install    
    # cd ..    

    3.5 安裝PHP-5.6.38    
    # tar -zxvf php-5.6.38.tar.gz    
    # cd php-5.6.38    
    # ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-gd --with-iconv --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --enable-bcmath --enable-shmop  --enable-sysvsem  --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --without-pear --with-openssl=/usr/local/openssl --enable-pcntl --enable-sockets --with-xmlrpc  --enable-zip  --enable-soap  --with-gettext --enable-session  --enable-mbstring --enable-mysqlnd --with-mysqli --with-pdo-mysql --with-mysql
    # make    
    # make install        
    # cp php.ini-development /usr/local/php/php.ini    
    # cd ..    
        
    3.6 修改apache配置    
    # vi /usr/local/apache/conf/httpd.conf    
        添加
        AddType application/x-httpd-php  .php
        AddType application/x-httpd-php-source .phps
        
        :wq
    # systemctl stop httpd.service
    # systemctl start httpd.service
        
    3.7 追加curl模塊    
    # tar zxvf curl-7.59.0.tar.gz    
    # cd curl-7.59.0    
    # ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl  --with-zlib    

      curl version:     7.59.0                
      Host setup:       x86_64-pc-linux-gnu                
      Install prefix:   /usr/local/curl                
      Compiler:         gcc                
      SSL support:      enabled (OpenSSL)                
      SSH support:      no      (--with-libssh2)                
      zlib support:     enabled                
      brotli support:   no      (--with-brotli)                
      GSS-API support:  no      (--with-gssapi)                
      TLS-SRP support:  enabled                
      resolver:         POSIX threaded                
      IPv6 support:     enabled                
      Unix sockets support: enabled                
      IDN support:      no      (--with-{libidn2,winidn})                
      Build libcurl:    Shared=yes, Static=yes                
      Built-in manual:  enabled                
      --libcurl option: enabled (--disable-libcurl-option)                
      Verbose errors:   enabled (--disable-verbose)                
      SSPI support:     no      (--enable-sspi)                
      ca cert bundle:   /etc/pki/tls/certs/ca-bundle.crt                
      ca cert path:     no                
      ca fallback:      no                
      LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)                
      LDAPS support:    no      (--enable-ldaps)                
      RTSP support:     enabled                
      RTMP support:     no      (--with-librtmp)                
      metalink support: no      (--with-libmetalink)                
      PSL support:      no      (libpsl not found)                
      HTTP2 support:    disabled (--with-nghttp2)                
      Protocols:        DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP                

    # make    
    # make install    
    # cd ..    
    
    3.8 配置php的curl擴展
    # cd php-7.2.5/ext/curl/    
    # /usr/local/php/bin/phpize    
    #  ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/curl    
    # make    
    # make install    
        Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

    # cd ..    
    # vi /usr/local/php/php.ini     
        追加
        extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/curl.so
        :wq
    # cd ../..    

    3.9 php配置xdebug擴展                
    # tar zxvf xdebug-2.5.5.tgz                
    # cd xdebug-2.5.5                
    # /usr/local/php/bin/phpize                
    # ./configure --with-php-config=/usr/local/php/bin/php-config                
    # make                
    # make install                
        Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20131226/            
                    
          +----------------------------------------------------------------------+            
          |                                                                      |            
          |   INSTALLATION INSTRUCTIONS                                          |            
          |   =========================                                          |            
          |                                                                      |            
          |   See http://xdebug.org/install.php#configure-php for instructions   |            
          |   on how to enable Xdebug for PHP.                                   |            
          |                                                                      |            
          |   Documentation is available online as well:                         |            
          |   - A list of all settings:  http://xdebug.org/docs-settings.php     |            
          |   - A list of all functions: http://xdebug.org/docs-functions.php    |            
          |   - Profiling instructions:  http://xdebug.org/docs-profiling2.php   |            
          |   - Remote debugging:        http://xdebug.org/docs-debugger.php     |            
          |                                                                      |            
          |                                                                      |            
          |   NOTE: Please disregard the message                                 |            
          |       You should add "extension=xdebug.so" to php.ini                |            
          |   that is emitted by the PECL installer. This does not work for      |            
          |   Xdebug.                                                            |            
          |                                                                      |            
          +----------------------------------------------------------------------+            
    # vi /usr/local/php/php.ini                 
        追加            
        extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/curl.so            
        :wq            
    # cd ..    
            
    3.10 php配置swoole擴展,swoole2.0.12起不再支持php5        
    # cd swoole-src-2.0.10-stable        
    # /usr/local/php/bin/phpize        
    # ./configure --with-php-config=/usr/local/php/bin/php-config --enable-openssl --with-openssl-dir=/usr/local/openssl --enable-swoole --enable-sockets --enable-mysqlnd        
    # make        
    # make install        
        Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20131226/    
        Installing header files:           /usr/local/php/include/php/    
    # vi /usr/local/php/php.ini         
        追加    
        extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/swoole.so    
        :wq    
    # cd ..        
    # systemctl restart httpd.service        
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章