Posts Tagged ‘mysql’

Tutorial Instalasi Apache 2, PHP 5 & MySQL 5 di Windows

Ingin membuat sebuah sistem informasi kita memerlukkan beberapa software pendukung seperti apache sebagai server, php sebagai software untuk menjalankan bahasa pemrogaraman , dan mysql untuk databasenya..tetapi itu belumlah cukup kita harus mengkoneksikan dengan mensetting(menkonfigurasi) php dengan mysql..Nah di bawah ini akan dejelaskan persiapan-persiapan software beserta konfigurasi instalasi apache2, php5, dan mysql5…..


Persiapan :

1. Download paket Apache 2.x.xx

Nama paket    :  Win32 Binary (MSI Installer) – apache_2.0.xx-win32-x86-no_ssl.msi

URL                :  http://httpd.apache.org/download.cgi

Ukuran file      :  Sekitar 6 MB

2. Download paket PHP 5.x.x

Nama paket    :  PHP 5.x.x zip package

(CGI binary plus server API versions for Apache, Apache2 (experimental), ISAPI, NSAPI, Servlet and Pi3Web. MySQL support built-in, many extensions included, packaged as zip)

URL                :  http://www.php.net/downloads.php

Ukuran           :  Sekitar 6,8 MB

3. Download paket MySQL 5.x.x

Nama paket    :  Windows Downloads – MySQL 5.x.x

URL                :  http://www.mysql.com/downloads/mysql-5.051a.html

Ukuran file      :  Sekitar 23 MB

Bila saat download ada keterangan untuk memilih server mirror, pilihlah yang kira-kira terdekat dengan Indonesia, lalu lanjutkan proses download. Sangat disarankan menggunakan program download manager, seperti Download Accelerator Plus, DownloadExpress, atau sejenisnya, untuk menghindari resiko putus sambungan.

Instalasi :

1. Instalasi Apache2

  • Jalankan file apache_2.2.xx-win32-x86-no_ssl.msi. Untuk keseragaman, installkan Apache2 di folder C:\. Hasilnya adalah Apache2 akan diinstall di folder C:\Apache2.2, dengan file apache.exe ada di folder C:\Apache2\bin.
  • Pilihlah untuk menjalankan Apache2 sebagai service, di port 80, sehingga secara otomatis setiap anda start-up Windows, Apache2 akan aktif.
  • Setelah selesai instalasi, maka di system tray akan muncul ico Apache Service Monitor. Klik dua kali untuk melihat status apakah Apache sudah aktif.
  • Buka browser, lalu akses http://localhost. Bila muncul tampilan :

Berarti instalasi Apache sudah beres dan sudah berjalan sebagai service.

  • Edit file C:\Apache2\conf\httpd.conf.

Tambahkan baris berikut di awal bagian LoadModule

LoadModule php5_module php/php5apache2_2.dll
AddType application/x-httpd-php .php

Cari bagian DirectoryIndex, lalu ubah menjadi :

DirectoryIndex index.html index.html.var index.php

Pastikan baris berikut sudah benar :

ServerRoot “C:/Apache2.2”
DocumentRoot “C:/Apache2.2/htdocs”

2. Instalasi PHP5

  • Ekstrak file hasil download ke folder apache2, sehingga file php.exe berada di folder C:\Apache2\php
  • Kopi file C:\Apache2.2\php\php5ts.dll ke folder C:\Apache2.2\bin
  • Kopi file C:\Apache2.2\php\php5apache2.dll ke C:\Apache2\bin
  • Kopi file C:\Apache2\php\php.ini-recommended ke folder C:\Apache2.2
  • Namakan file C:\Apache2.2\php.ini-recommended menjadi C:\Apache2.2\php.ini
  • Edit file C:\Apache2.2\php.ini. Sesuaikan dengan keterangan berikut :
…..
output_buffering = 4096
…..
zlib.output_compression = On
…..
extension_dir = “c:/Apache2.2/php/extensions”
  • Oke, sekarang restart Apache untuk menguji apakah PHP sudah berjalan sebagai modul Apache. Ada dua cara untuk restart Apache :
  1. Menggunakan Apache Service Monitor, klik dua kali ikon Apache Service Monitor di system tray, lalu klik tombol restart
  2. Dari perintah konsol. Start menu à run à cmd. Anda masuk ke konsol Windows. Lalu ketikkan :
C:\path>net stop apache2.2
The Apache2 service is stopping…
The Apache2 service was stopped successfully.
C:\path>net start apache2.2
The Apache2 service is starting..
The Apache2 service was started successfully.

Untuk kedua cara di atas, bila tidak ada pesan error apa pun, berarti PHP sudah diinstall dengan baik sebagai modul Apache. Coba cek lagi Apache Service Monitor, di bagian bawahnya nanti akan muncul tulisan :

Apache/2.2.8(Win32)PHP/5.2.5

3. Instalasi MySQL 5

  • Ekstrak file .zip hasil download. Jalankan file setup.exe. Pilih folder C:\Apache2.2\mysql bila ditanyakan di mana anda ingin menginstall MySQL server.
  • Jalankan mysql command line client. Isikan password untuk root user (user dengan akses tertinggi) sesuka hati anda.

Perhatian :

Password yang baru saja anda masukkan, akan disimpan dalam file my.ini dalam format plain text, dan tanpa enkripsi sama sekali. Bacalah manual MySQL mengenai mengganti password root langsung dari konsol mysql.

  • Pilih menu my.ini Setup. Di sebelah kiri, di bagian mysqld file, pilihlah mysqld-max-nt. Lalu klik tombol Save Modification.
  • Restart mysql, dengan cara :
  1. Dari konsol (Start menu à Run à cmd)
C:\path>net stop mysql
The MySql service is stopping.
The MySql service was stopped successfully.
C:\path>net start mysql
The MySql service is starting.
The MySql service was started successfully.