Install dan Konfigurasi Apache dan PHP pada Sistem Operasi Windows 64 bit.
Download & Install :
- Microsoft Visual C++ 2011 Redistributable Package x64
- Microsoft Visual C++ 2013 Redistributable Package x64
- Microsoft .NET 4.0
Download Apache & PHP x64
- httpd-2.4.12-win64-VC11.zip
- php-5.6.9-Win32-VC11-x64.zip
Extract ke root folder webserver. Pada kasus ini kita menggunakan lokasi : D:\webserver.
Sekarang terdapat 2 folder yang ada di D:\webserver, yaitu :
- Apache24
- PHP
Edit file httpd.conf
menjadi #ServerAdmin
[email protected]Hapus code berikut :
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
Cari dan ubah kata c:/Apache24 dengan D:/webserver/Apache24
Pada bagian akhir LoadModule tambahkan code berikut :
LoadModule php5_module "d:/webserver/PHP/php5apache2_4.dll"
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
<IfModule php5_module>
PHPINIDir "d:/webserver/PHP"
</IfModule>
pada bagian <IfModule dir_module>
ubah DirectoryIndex index.html menjadi DirectoryIndex index.html index.php
pada bagian # Virtual hosts
ubah #Include conf/extra/httpd-vhosts.conf
menjadi Include conf/extra/httpd-vhosts.conf
Kemudian Save.
Edit File httpd-vhosts.conf
Tambahkan code berikut pada bagian akhir.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost.com
DocumentRoot "d:/webserver/Apache24/htdocs"
<Directory />
AllowOverride All
Option none
Require all granted
</Directory>
<Directory "d:/webserver/Apache24/htdocs">
Options Indexes FollowSymLinks ExecCGI MultiViews
AllowOverride All
Require all granted
</Directory>
#Alias /doc/ "/usr/share/doc/"
#<Directory "/usr/share/doc/">
# Options Indexes MultiViews FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
# Allow from 127.0.0.0/255.0.0.0 ::1/128
#</Directory>
</VirtualHost>
Kemudian Save.
Catatan :
d:/webserver/Apache24/htdocs adalah lokasi penyimpanan halaman website anda nantinya.
Lokasi ini anda bisa ubah sesuai dengan keinginan anda.
Edit file php.ini
Copy file php.ini-production yang ada di folder D:\webserver\PHP dan rename menjadi
php.ini
Edit file php.ini
Menetukan lokasi extension (library) :
Cari dan ubah kata ;extension_dir = "ext"
menjadi extension_dir = "d:\webserver\PHP\ext"
Mengaktifkan extension :
cari kata dibawah dan hapus symbol ; (titik koma) yang ada didepan kata tersebut.
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_openssl.dll
;extension=php_pdo_sqlite.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
Kemudian Save.
Masukkan ;D:\webserver\php\;D:\webserver\php\ext\; ke System Variable PATH pada
Environment Variable komputer anda.
Menginstall dan menjalankan applikasi Apache.
Buka command prompt
Ketik D: lalu tekan enter.
Ketik cd webserver\Apache24\bin lalu tekan enter.
Ketik httpd.exe -k install lalu tekan enter.
Lalu Restart Komputer anda.
Buat file baru, lalu masukkan code berikut :
<?php phpinfo(); ?>
Lalu Save dengan nama phpinfo.php pada d:/webserver/Apache24/htdocs
Buka applikasi browser, lalu ketik pada address bar : http://localhost/phpinfo.php
Jika halaman Informasi PHP tampil pada browser anda, Anda sukses melakukan instalasi Apache dan
PHP pada Sistem Operasi Windows 64 bit.
Instalasi MySQL x64 dan phpMyAdmin
Download MySQL x64 :
- mysql-5.6.26-winx64.zip
Catatan :
Pada kasus ini kita menggunakan package Zip Archive bukan Installer MSI.
Extract file mysql-5.6.26-winx64.zip pada D:\webserver
Kemudian rename folder mysql-5.6.26-winx64 menjadi MySQL.
Buat file baru dengan nama my.ini, lalu masukkan code berikut :
[client]
port = 3306
socket = "D:/webserver/MySQL/MySQL.sock"
[mysql]
default-character-set=utf8
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port = 3306
socket = "D:/webserver/MySQL/MySQL.sock"
# Path to installation directory.
basedir = "D:/webserver/MySQL"
# Path to the database root
datadir = "D:/webserver/MySQL/data"
#PID file
pid_file = "MySQL.pid"
# General and Slow logging.
log-output=NONE
general-log=0
general_log_file="mysql_general.log"
slow-query-log=0
slow_query_log_file="mysql_slow_query.log"
long_query_time=10
# Error Logging.
log-error="mysql_error.log"
#timestamp
explicit_defaults_for_timestamp = TRUE
# The default character set that will be used when a new schema or table is
character-set-server=utf8
Lalu save di D:\webserver\MySQL
Buka command prompt
Ketik D: lalu tekan enter.
Ketik cd webserver\MySQL\bin lalu tekan enter.
Ketik mysqld.exe -–install MySQL -—defaults-file=”D:\webserver\MySQL\my.ini”
lalu tekan enter.
Ketik mysqld.exe lalu tekan enter.
Menguji Koneksi PHP dan MySQL
Buat file baru, lalu masukkan code berikut :
<?php
$servername = "localhost"; $username = "root"; $password = "";
// Create connection
$conn = @mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {
die("Connection Failed: " . mysqli_connect_error().'<br/>');
} else {
echo "Connection Succesfull".'<br/>';
}
// Check database
if(!@mysqli_select_db($conn, 'mysql')) {
die('Failed to connect to the Database: ' . mysqli_error($link));
} else {
echo "Database Connected";
}
?>
Lalu Save dengan nama mysqltest.php pada d:/webserver/Apache24/htdocs
Buka applikasi browser, lalu ketik pada address bar : http://localhost/mysqltest.php
Mengaktifkan password root MySQL
Ketik D: lalu tekan enter.
Ketik cd webserver\MySQL\bin lalu tekan enter.
Ketik mysqladmin –u root password “passwordbar” lalu tekan enter.
Mengganti password root MySQL
Ketik D: lalu tekan enter.
Ketik cd webserver\MySQL\bin lalu tekan enter.
Ketik mysqladmin –u root –p”passwordlama” root password “passwordbaru” lalu tekan
enter.
Mengaktifkan event scheduler
Edit my.ini, lalu pada bagian tag [mysqld] tambahkan code berikut :
#event scheduler
event-scheduler = On
Catatan :
MySQL 5.6.26 ini mempunya bug innodb.
Adapun bug fixnya silahkan mendownloadnya pada link ini http://bugs.mysql.com/file.php?id=19725
Instalasi phpMyAdmin
Download phpMyadmin :
- phpMyAdmin-4.4.7-all-languages.zip
Extract file phpMyAdmin-4.4.7-all-languages.zip ke Directory D:\Webserver
Kemudian rename folder phpMyAdmin-4.4.7-all-languages menjadi phpMyAdmin
Buka Directory D:\Webserver\phpMyadmin, lalu copy file config.sample.inc.php dan rename
menjadi config.inc.php
Edit config.inc.php
Mengenkripsi password authentikasi cookie :
Edit code berikut
$cfg['blowfish_secret'] = ''; ubah menjadi $cfg['blowfish_secret'] = 'secret code
anda';
Mengijinkan akses phpMyadmin tanpa password:
Langkah ini dilakukan jika password user root MySQL anda tidak aktif
Edit code berikut
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Ubah menjadi $cfg['Servers'][$i]['AllowNoPassword'] = true;
Kemudian Save.
Configurasi Apache
Pada kasus ini kita menggunakan VirtualHost port 2082
Buka directory D:\webserver\Apache24
Kemudia buat folder baru dengan nama htdocs2082
Edit File httpd.conf
Buka file httpd.conf
Tambahkan code berikut setelah kata Listen 80
Listen 2082
Kemudian Save.
Edit File httpd-vhosts.conf
Tambahkan pada bagian akhir code berikut :
<VirtualHost *:2082>
ServerAdmin webmaster@localhost
ServerName localhost:2082
DocumentRoot "d:/webserver/Apache24/htdocs2082"
<Directory />
AllowOverride All
Options None
Require all granted
</Directory>
<Directory "d:/webserver/Apache24/htdocs2082">
Options Indexes FollowSymLinks ExecCGI MultiViews
AllowOverride All
Require all granted
</Directory>
Alias /phpmyadmin "d:/webserver/phpmyadmin"
<Directory "d:/webserver/phpmyadmin">
Options FollowSymLinks
DirectoryIndex index.php
<IfModule php5_module>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
</IfModule>
</Directory>
</VirtualHost>
Lalu kemudia Save.
Restart Service Apache .
Buka applikasi browser, lalu ketik pada address bar : http://localhost:2082/phpmyadmin
Catatan :
2082 bisa anda ubah sesuai dengan keinginan anda.
Install ImageMagick dan Ghostscript
Download ImageMagick, library php-imagick.dll dan ghostscript
- ImageMagick-6.9.1-2-Q16-x64-dll.exe
- php_imagick-3.3.0rc2-5.6-ts-vc11-x64.zip
- gs916w32.exe
Install ImageMagick-6.9.1-2-Q16-x64-dll.exe opsi install :
- target installasi ke C:\ImageMagick atau D:\webserver\ImageMagick
- Centang Create a desktop icon dan Add application directory to your system path
Extract file php_imagick-3.3.0rc2-5.6-ts-vc11-x64.zip,
lalu copy file php_imagick.dll ke directory D:\webserver\PHP\ext
Install GhostScript (gs916w32.exe)
Edit file php.ini
Pada bagian Dynamic Extension, tambahkan code berikut :
extension=php_imagick.dll
Kemudian Save.
Restart Service Apache.
Lakukan pengecekan di Informasi PHP.