Thứ Sáu, 9 tháng 12, 2016

Install PHP & Apache from sourcecode

[root@kiloccnp httpd-2.4.23]# yum install libxml2-static.x86_64 libxml2.x86_64 libxml2-devel.x86_64
[root@kiloccnp php-5.6.28]# yum install gsm.x86_64 gsm-devel.x86_64 gsm-tools.x86_64 libxslt.x86_64
[root@kiloccnp php-5.6.28]# yum install icu.x86_64 libicu.x86_64 libicu-devel.x86_64 libicu-doc.noarch
[root@kiloccnp php-5.6.28]# yum install unixODBC.x86_64 unixODBC-devel.x86_64
[root@kiloccnp curl]# yum install libcurl-devel.x86_64 libcurl.x86_64
[root@kiloccnp gd]# yum install dvipng.x86_64 libpng.x86_64 libpng-devel.x86_64 libpng-static.x86_64 gd.x86_64
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html  (download for oci8 )
[root@kiloccnp ~]# rpm -Uvh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
[root@kiloccnp ~]# rpm -Uvh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

[root@kiloccnp htdocs]# yum install gd-devel.x86_64 gupnp-igd-devel.x86_64
[root@kiloccnp ~]# yum install freetype-demos.x86_64 freetype-devel.x86_64 freetype.x86_64
[root@kiloccnp gd]# yum install libjpeg.x86_64 libjpeg-devel.x86_64 libjpeg-static.x86_64 openjpeg.x86_64 openjpeg-devel.x86_64 openjpeg-libs.x86_64
[root@kiloccnp ~]# yum install dvipng.x86_64 libpng.x86_64 libpng-devel.x86_64 libpng-static.x86_64
[root@kiloccnp ~]# yum install libvpx-devel.x86_64 libvpx.x86_64 libvpx-utils.x86_64
[root@kiloccnp ~]# yum install t1lib-apps.x86_64 t1lib-devel.x86_64 t1lib-static.x86_64  t1lib.x86_64
[root@kiloccnp gd]# rpm -vih re2c-0.13.5-1.el6.x86_64.rpm

[root@kiloccnp ~]# bunzip2 apr-1.5.2.tar.bz2
[root@kiloccnp ~]# tar -xvf apr-1.5.2.tar
[root@kiloccnp ~]#./configure
[root@kiloccnp ~]#make
[root@kiloccnp ~]#make install



[root@kiloccnp ~]# bunzip2 apr-util-1.5.4.tar.bz2
[root@kiloccnp ~]# tar -xvf apr-util-1.5.4.tar
[root@kiloccnp ~]# cd apr-util-1.5.4
[root@kiloccnp apr-util-1.5.4]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config
[root@kiloccnp apr-util-1.5.4]#make
[root@kiloccnp apr-util-1.5.4]#make install




[root@kiloccnp ~]# bunzip2 pcre2-10.21.tar.bz2
[root@kiloccnp ~]# tar -xvf pcre2-10.21.tar
[root@kiloccnp pcre2-10.21]# ./configure
[root@kiloccnp pcre2-10.21]# make
[root@kiloccnp pcre2-10.21]# make install



[root@kiloccnp ~]# bunzip2 pcre-8.39.tar.bz2
[root@kiloccnp ~]# tar -xvf pcre-8.39.tar
[root@kiloccnp pcre-8.39]# ./configure
[root@kiloccnp pcre-8.39]# make
[root@kiloccnp pcre-8.39]# make insatll


[root@kiloccnp ~]#bunzip2 httpd-2.4.23.tar.bz2
[root@kiloccnp ~]# tar -xvf httpd-2.4.23.tar
[root@kiloccnp ~]# cd httpd-2.2.31
[root@kiloccnp httpd-2.4.23]#  ./configure --enable-authn-dbd --disable-authn-default --enable-authn-alias --enable-authz-dbm  --enable-authz-owner --enable-auth-digest --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-reqtimeout  --enable-headers --enable-proxy  --enable-proxy-http --enable-ssl --enable-dav  --enable-info --enable-cgi  --enable-cgid  --enable-dav-fs  --enable-dav-lock  --enable-vhost-alias  --enable-imagemap --enable-speling --enable-rewrite  --enable-so --enable-buffer  --enable-data  --enable-ratelimit --enable-request --enable-reflector --enable-charset-lite --enable-xml2enc --enable-log-debug --enable-lua --enable-ident  --enable-usertrack --enable-unique-id --enable-remoteip --enable-proxy-scgi  --enable-session  --enable-session-cookie --enable-session-dbd --enable-http --enable-unixd --enable-heartbeat --enable-heartmonitor  --enable-asis --enable-suexec --enable-cgi --enable-negotiation --enable-actions --enable-userdir
[root@kiloccnp httpd-2.4.23]# make
[root@kiloccnp httpd-2.4.23]#  make install
root@kiloccnp conf]#  /usr/local/apache2/bin/apachectl start

[root@kiloccnp conf]# ps aux | grep http
root     16742  0.0  0.0  56760  3040 ?        Ss   15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16744  0.0  0.0  56672  1864 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16745  0.0  0.0  56760  1928 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16746  0.0  0.0  56760  1928 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16747  0.0  0.0  56760  1928 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16748  0.0  0.0  56760  1928 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
daemon   16749  0.0  0.0  56760  1928 ?        S    15:00   0:00 /usr/local/apache2/bin/httpd -k start
root     16751  0.0  0.0 103368   844 pts/1    S+   15:00   0:00 grep http

[root@kiloccnp conf]#  /usr/local/apache2/bin/httpd --version
AH00557: httpd: apr_sockaddr_info_get() failed for kiloccnp
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd (pid 3305) already running

[root@kiloccnp httpd-2.4.23]# /usr/local/apache2/bin/apachectl -v
Server version: Apache/2.4.23 (Unix)
Server built:   Dec  8 2016 15:46:37
[root@kiloccnp httpd-2.4.23]#



[root@kiloccnp conf]#
[root@kiloccnp ~]# bunzip2 php-5.6.28.tar.bz2
[root@kiloccnp ~]# tar -xvf php-5.6.28.tar
[root@kiloccnp ~]# cd php-5.6.28
[root@kiloccnp php-5.6.28]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-intl --enable-mbstring  --enable-embedded-mysqli --enable-pcntl --enable-soap --enable-sockets --enable-sysvmsg  --enable-sysvsem --enable-zip --enable-mysqlnd --enable-libgcc --with-system-ciphers --enable-bcmath --enable-calendar --enable-dba
[root@kiloccnp php-5.6.28]# make
[root@kiloccnp php-5.6.28]# make install
[root@kiloccnp php-5.6.28]# php -v
PHP 5.6.28 (cli) (built: Dec  8 2016 16:38:08)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[root@kiloccnp php-5.6.28]#

[root@kiloccnp php-5.6.28]# /usr/local/apache2/bin/apachectl restart
AH00557: httpd: apr_sockaddr_info_get() failed for kiloccnp
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[root@kiloccnp php-5.6.28]#
[root@kiloccnp php-5.6.28]# cd /usr/local/apache2/htdocs
[root@kiloccnp htdocs]# vim test.php
<?php
phpinfo();
?>
[root@kiloccnp php-5.6.28]# cp php.ini-production /usr/local/lib/php.ini
[root@kiloccnp mysql]# cd /root/php-5.6.28/ext/mysql
[root@kiloccnp mysql]# phpize
[root@kiloccnp mysql]# ./configure
[root@kiloccnp mysql]# make
[root@kiloccnp extensions]# cd /usr/local/lib/php/extensions
[root@kiloccnp extensions]# cp /root/php-5.6.28/ext/mysql/modules/mysql.so  ./
[root@kiloccnp ext]# cd /root/php-5.6.28/ext/
[root@kiloccnp curl]# phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
[root@kiloccnp curl]# ./configure
[root@kiloccnp curl]# make
[root@kiloccnp curl]# cp modules/curl.so /usr/local/lib/php/extensions/
[root@kiloccnp curl]# cd ../fileinfo/     
[root@kiloccnp fileinfo]# phpize
[root@kiloccnp fileinfo]# make
[root@kiloccnp fileinfo]# cd ../gd/
[root@kiloccnp gd]# phpize
[root@kiloccnp gd]#./configure --with-freetype-dir=/usr/lib64/libfreetype.so --with-jpeg-dir=/usr/lib64/libjpeg.so --enable-gd-native-ttf --with-libdir=/usr/lib64/
[root@kiloccnp gd]# make
[root@kiloccnp gd]# cp modules/gd.so /usr/local/lib/php/extensions/
[root@kiloccnp gd]# cd ../gettext/
[root@kiloccnp gettext]# phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
[root@kiloccnp gettext]# ./configure
[root@kiloccnp gettext]# make
[root@kiloccnp gettext]# cp modules/gettext.so /usr/local/lib/php/extensions/
[root@kiloccnp gettext]# cd ../oci8/
[root@kiloccnp oci8]# phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
[root@kiloccnp oci8]# ./configure --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib/
[root@kiloccnp oci8]# make
[root@kiloccnp oci8]# cp modules/oci8.so /usr/local/lib/php/extensions/
[root@kiloccnp oci8]# cd ../soap/
[root@kiloccnp soap]# phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
[root@kiloccnp soap]# ./configure
[root@kiloccnp soap]# make
[root@kiloccnp soap]# cp modules/soap.so /usr/local/lib/php/extensions/
[root@kiloccnp soap]# cd ../mssql/
[root@kiloccnp mssql]# phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
[root@kiloccnp mssql]# ./configure


[root@kiloccnp soap]# vim /usr/local/lib/php.ini
 extension=/usr/local/lib/php/extensions/mysql.so
 extension=/usr/local/lib/php/extensions/curl.so
 extension=/usr/local/lib/php/extensions/fileinfo.so
 extension=/usr/local/lib/php/extensions/gd.so
 extension=/usr/local/lib/php/extensions/gettext.so
 extension=/usr/local/lib/php/extensions/oci8.so
 extension=/usr/local/lib/php/extensions/soap.so

[root@kiloccnp ~]# cat /usr/local/apache2/conf/httpd.conf
ServerRoot "/usr/local/apache2"
Listen 80
Listen 443

LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule data_module modules/mod_data.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule deflate_module modules/mod_deflate.so
#LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule logio_module modules/mod_logio.so
#LoadModule lua_module modules/mod_lua.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule ssl_module modules/mod_ssl.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
#LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
#LoadModule suexec_module modules/mod_suexec.so
<IfModule !mpm_prefork_module>
        #LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        #LoadModule cgi_module modules/mod_cgi.so
</IfModule>
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule imagemap_module modules/mod_imagemap.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module        modules/libphp5.so

<IfModule unixd_module>
#
User daemon
Group daemon

</IfModule>
ServerAdmin kiloccnp@gmail.com

ServerName kiloccnp.com.vn

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

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

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"
LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .php
    AddHandler php5-script      .php
</IfModule>


# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

#NameVirtualHost *:80
#NameVirtualHost *:443

<VirtualHost *:80>

    ServerAdmin kiloccnp@gmail.com

        DocumentRoot   /usr/local/apache2/htdocs
        ServerName  X.X.X.X
        ServerAlias     X.X.X.X
        <Directory  /usr/local/apache2/htdocs>

            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        </Directory>

        <Directory />
            Options FollowSymLinks
            AllowOverride all
        </Directory>

    ErrorLog /usr/local/apache2/logs/htdl_error.log
    LogLevel warn

    CustomLog /usr/local/apache2/logs/htdl_access.log combined
    ServerSignature On

</VirtualHost>

<VirtualHost *:443>
        ServerAdmin support@email.com

        DocumentRoot    /usr/local/apache2/htdocs
        ServerName  X.X.X.X
        ServerAlias     X.X.X.X
        <Directory  /usr/local/apache2/htdocs>

            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        </Directory>

        <Directory />
            Options FollowSymLinks
            AllowOverride all
        </Directory>

    ErrorLog /usr/local/apache2/logs/htdl_SSL_error.log
    LogLevel warn

    CustomLog /usr/local/apache2/logs/htdl_access.log combined
    ServerSignature On

    SSLEngine on
    SSLCertificateFile /usr/local/apache2/conf/hotrodaily.cer
    SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key

</VirtualHost>
[root@kiloccnp ~]#

Không có nhận xét nào:

Đăng nhận xét