Skip to content


Install dan Konfigurasi Apache + PHP + MySQL

server# ee /etc/make.conf

Tambahkan baris berikut pada /etc/make.conf :

# Apache + PHP
WITH_APACHE_MODDEFLATE=yes
WITHOUT_X11=yes
WITH_PROXY_MODULES=yes
WITH_THREADS_MODULES=yes

# mysql
BUILD_OPTIMIZED=yes
BUILD_STATIC=yes
WITHOUT_INNODB=yes

Install MySQL Database Server

server# cd /usr/ports/databases/mysql51-server/
server# make
server# make install
server# make clean

Install Apache Server

server# cd /usr/ports/www/apache22/
server# make config

Ubah konfigurasi module Apache yang di-install menjadi :

[X] APR_FROM_PORTS        Use devel/apr as APR (preferred)
[X] THREADS               Enable threads support in APR
[ ] MYSQL                 Enable MySQL support for apr-dbd
[ ] PGSQL                 Enable PostgreSQL support for apr-dbd
[ ] SQLITE                Enable SQLite support for apr-dbd
[ ] IPV6                  Enable IPv6 support
[ ] BDB                   Enable BerkeleyDB dbm
[X] AUTH_BASIC            Enable mod_auth_basic
[X] AUTH_DIGEST           Enable mod_auth_digest
[X] AUTHN_FILE            Enable mod_authn_file
[ ] AUTHN_DBD             Enable mod_authn_dbd
[X] AUTHN_DBM             Enable mod_authn_dbm
[X] AUTHN_ANON            Enable mod_authn_anon
[X] AUTHN_DEFAULT         Enable mod_authn_default
[X] AUTHN_ALIAS           Enable mod_authn_alias
[X] AUTHZ_HOST            Enable mod_authz_host
[X] AUTHZ_GROUPFILE       Enable mod_authz_groupfile
[X] AUTHZ_USER            Enable mod_authz_user
[X] AUTHZ_DBM             Enable mod_authz_dbm
[X] AUTHZ_OWNER           Enable mod_authz_owner
[X] AUTHZ_DEFAULT         Enable mod_authz_default
[X] CACHE                 Enable mod_cache
[X] DISK_CACHE            Enable mod_disk_cache
[X] FILE_CACHE            Enable mod_file_cache
[ ] MEM_CACHE             Enable mod_mem_cache
[X] DAV                   Enable mod_dav
[X] DAV_FS                Enable mod_dav_fs
[ ] BUCKETEER             Enable mod_bucketeer
[ ] CASE_FILTER           Enable mod_case_filter
[ ] CASE_FILTER_IN        Enable mod_case_filter_in
[ ] EXT_FILTER            Enable mod_ext_filter
[ ] LOG_FORENSIC          Enable mod_log_forensic
[ ] OPTIONAL_HOOK_EXPORT  Enable mod_optional_hook_export
[ ] OPTIONAL_HOOK_IMPORT  Enable mod_optional_hook_import
[ ] OPTIONAL_FN_IMPORT    Enable mod_optional_fn_import
[ ] OPTIONAL_FN_EXPORT    Enable mod_optional_fn_export
[ ] LDAP                  Enable mod_ldap
[ ] AUTHNZ_LDAP           Enable mod_authnz_ldap
[X] ACTIONS               Enable mod_actions
[X] ALIAS                 Enable mod_alias
[X] ASIS                  Enable mod_asis
[X] AUTOINDEX             Enable mod_autoindex
[X] CERN_META             Enable mod_cern_meta
[X] CGI                   Enable mod_cgi
[X] CHARSET_LITE          Enable mod_charset_lite
[ ] DBD                   Enable mod_dbd
[X] DEFLATE               Enable mod_deflate
[X] DIR                   Enable mod_dir
[X] DUMPIO                Enable mod_dumpio
[X] ENV                   Enable mod_env
[X] EXPIRES               Enable mod_expires
[X] HEADERS               Enable mod_headers
[X] IMAGEMAP              Enable mod_imagemap
[X] INCLUDE               Enable mod_include
[X] INFO                  Enable mod_info
[X] LOG_CONFIG            Enable mod_log_config
[X] LOGIO                 Enable mod_logio
[X] MIME                  Enable mod_mime
[X] MIME_MAGIC            Enable mod_mime_magic
[X] NEGOTIATION           Enable mod_negotiation
[X] REWRITE               Enable mod_rewrite
[X] SETENVIF              Enable mod_setenvif
[X] SPELING               Enable mod_speling
[X] STATUS                Enable mod_status
[X] UNIQUE_ID             Enable mod_unique_id
[X] USERDIR               Enable mod_userdir
[X] USERTRACK             Enable mod_usertrack
[X] VHOST_ALIAS           Enable mod_vhost_alias
[X] FILTER                Enable mod_filter
[X] VERSION               Enable mod_version
[ ] PROXY                 Enable mod_proxy
[ ] PROXY_CONNECT         Enable mod_proxy_connect
[X] PATCH_PROXY_CONNECT   Patch proxy_connect SSL support
[ ] PROXY_FTP             Enable mod_proxy_ftp
[ ] PROXY_HTTP            Enable mod_proxy_http
[ ] PROXY_AJP             Enable mod_proxy_ajp
[ ] PROXY_BALANCER        Enable mod_proxy_balancer
[X] SSL                   Enable mod_ssl
[ ] SUEXEC                Enable mod_suexec
[ ] CGID                  Enable mod_cgid
server# make
server# make install
server# make clean

Konfigurasi dependensi aplikasi Apache :

apache-mysql-php-01

apache-mysql-php-02

Install PHP

cd /usr/ports/lang/php5/
server# make config

Tentukan konfigurasi PHP, jangan lupa memilih Build Apache Module.

apache-mysql-php-03

server# make
server# make install
server# make clean

Install Ekstensi PHP

cd /usr/ports/lang/php5-extensions/
server# make config

Pilih ekstensi PHP yang diinginkan :

[ ] BCMATH      bc style precision math functions
[X] BZ2         bzip2 library support
[ ] CALENDAR    calendar conversion support
[X] CTYPE       ctype functions
[ ] CURL        CURL support
[ ] DBA         dba support
[ ] DBASE       dBase library support
[X] DOM         DOM support
[ ] EXIF        EXIF support
[ ] FILEINFO    fileinfo support
[X] FILTER      input filter support
[ ] FRIBIDI     FriBidi support
[ ] FTP         FTP support
[X] GD          GD library support
[ ] GETTEXT     gettext library support
[ ] GMP         GNU MP support
[X] HASH        HASH Message Digest Framework
[X] ICONV       iconv support
[ ] IMAP        IMAP support
[ ] INTERBASE   Interbase 6 database support (Firebird)
[X] JSON        JavaScript Object Serialization support
[ ] LDAP        OpenLDAP support
[ ] MBSTRING    multibyte string support
[X] MCRYPT      Encryption support
[X] MHASH       Crypto-hashing support
[ ] MING        ming shockwave flash support
[ ] MSSQL       MS-SQL database support
[X] MYSQL       MySQL database support
[ ] MYSQLI      MySQLi database support
[ ] NCURSES     ncurses support (CLI only)
[ ] ODBC        unixODBC support
[ ] OPENSSL     OpenSSL support
[ ] PCNTL       pcntl support (CLI only)
[X] PCRE        Perl Compatible Regular Expression support
[ ] PDF         PDFlib support (implies GD)
[ ] PDO         PHP Data Objects Interface (PDO)
[ ] PDO_SQLITE  PDO sqlite driver
[ ] PGSQL       PostgreSQL database support
[X] POSIX       POSIX-like functions
[ ] PSPELL      pspell support
[ ] READLINE    readline support (CLI only)
[ ] RECODE      recode support
[X] SESSION     session support
[ ] SHMOP       shmop support
[X] SIMPLEXML   simplexml support
[ ] SNMP        SNMP support
[ ] SOAP        SOAP support
[ ] SOCKETS     sockets support
[X] SPL         Standard PHP Library
[ ] SQLITE      sqlite support
[ ] SYBASE_CT   Sybase database support
[ ] SYSVMSG     System V message support
[ ] SYSVSEM     System V semaphore support
[ ] SYSVSHM     System V shared memory support
[ ] TIDY        TIDY support
[X] TOKENIZER   tokenizer support
[ ] WDDX        WDDX support (implies XML)
[X] XML         XML support
[X] XMLREADER   XMLReader support
[ ] XMLRPC      XMLRPC-EPI support
[X] XMLWRITER   XMLWriter support
[ ] XSL         XSL support (Implies DOM)
[ ] YAZ         YAZ support (ANSI/NISO Z39.50)
[X] ZIP         ZIP support
[X] ZLIB        ZLIB support


server# make
server# make install
server# make clean

Konfigurasi dependensi aplikasi :

apache-mysql-php-04

apache-mysql-php-05

Install xCache

cd /usr/ports/www/xcache/
server# make config
server# make
server# make install
server# make clean
server# cp /usr/local/share/examples/xcache/xcache.ini /usr/local/etc/php/

Menampilkan informasi versi PHP :

server# /usr/local/bin/php -v

PHP 5.2.10 with Suhosin-Patch 0.9.7 (cli) (built: Sep 7 2009 21:52:15) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with XCache v1.3.0, Copyright (c) 2005-2009, by mOo

Melihat informasi ekstensi PHP yang aktif :

server# /usr/local/bin/php -m

[PHP Modules]
bz2
ctype
date
dom
filter
gd
hash
iconv
json
libxml
mcrypt
mhash
mysql
pcre
posix
Reflection
session
SimpleXML
SPL
standard
tokenizer
XCache
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]
XCache

Aktifkan php.ini :

 server# cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini

Aktifkan Apache dan MySQL di /etc/rc.conf :

server# ee /etc/rc.conf

Tambahkan baris berikut pada bagian akhir /etc/rc.conf :

apache22_enable="YES"
mysql_enable="YES"

Membuat database standart MySQL, jalankan dan ubah password root MySQL :

server# /usr/local/bin/mysql_install_db
server# chown -R mysql:mysql /var/db/mysql
server# /usr/local/etc/rc.d/mysql-server start
server# /usr/local/bin/mysqladmin -u root password 'passwordbaruroot'

Ganti passwordbaruroot dengan password yang diinginkan Update seluruh password root dan hapus User yang kosong untuk keamanan :

server# /usr/local/bin/mysql -u root -p

Enter password: <masukkan password root mysql> Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.38 FreeBSD port: mysql-server-5.1.38 Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
mysql> update user set Password=password('passwordbaruroot') where User='root';
mysql> delete from user where User='';
mysql> quit;

Ganti passwordbaruroot dengan password yang diinginkan Restart MySQL :

server# /usr/local/etc/rc.d/mysql-server restart


Konfigurasi dan menjalankan Apache :

server# ee /usr/local/etc/apache22/httpd.conf

Ubah baris #216 menjadi :

    DirectoryIndex index.php index.html

Tambahkan baris berikut pada bagian akhir file :

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Cek konfigurasi Apache :

server# /usr/local/sbin/apachectl configtest

Syntax OK

Jalankan Apache :

server# /usr/local/etc/rc.d/apache22 start

Cek status service Apache :

server# /usr/local/etc/rc.d/apache22 status

apache22 is running as pid 28914.

Test akses ke IP mesin menggunakan browser :

apache-mysql-php-06

Test menampilkan informasi PHP dengan script /usr/local/www/apache22/data/index.php :

server# ee /usr/local/www/apache22/data/index.php

Ketikkan baris berikut :

<?php phpinfo(); ?>

Simpan dan keluar, test melalui browser :

apache-mysql-php-07

Proses instalasi Apache, PHP + xCache dan MySQL telah selesai.

Share

Posted in FreeBSD.

Tagged with , , , , .

The On Demand Global Workforce - oDesk


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. DEZ says

    TULISAN BAGUS/….



Some HTML is OK

or, reply to this post via trackback.