how to install apache - php - mysql - php my admin on windows 7

18
SQ http://sq.web.id 1 How To Install Apache, PHP, MySQL, and PhpMyAdmin On Microsoft Windows 7 Author : A. SidiQ P. (DnD Sandy Ra) Email : [email protected] 1. Requirements & Directory Structure Assumption Requirements : 1. Apache 2.2.1 or Latest version o Select Win32 Binary without crypto (no mod_ssl) or Win32 Binary including OpenSSL 0.9.8r (MSI Installer) Win32 Binary Package o Url : http://httpd.apache.org/download.cgi 2. PHP 5.3 or Latest version o Select type Thread Safe installer version for Windows Win32 Binary Package o Url : http://windows.php.net/download 3. MySQL 5.5.17 or Latest version o Select Windows (x86, 32-bit), MSI Installer Win32 Binary Package o Url : http://dev.mysql.com/downloads/ 4. PhpMyAdmin 3.4.7 or Latest version o Select phpMyAdmin *.zip version o Url : http://www.phpmyadmin.net/home_page/downloads.php Directory Structure Assumption 1. Create a new directory "DnDAMPP" in drive C: \. This directory will be used as a place to install Apache, PHP, MySQL, and PhpMyAdmin. 2. The directory structure will be as shown below : C:\ .\Program Files .\Windows .\User .\DnDAMPP ..\Apache2.2 ..\MySQL ..\PHP \phpmyadmin Lisensi Dokumen: Copyright © 2011 sq.web.id Seluruh dokumen di sq.web.id dapat digunakan, dimodifikasi dan disebarkan secara bebas untuk tujuan pendidikan (bukan komersial (nonprofit)), dengan syarat tidak menghapus atau merubah atribut penulis dan pernyataan copyright yang disertakan dalam setiap dokumen.

Upload: a-sidiq-purnomo

Post on 07-Oct-2014

168 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 1

How To Install Apache, PHP, MySQL, and PhpMyAdmin On Microsoft Windows 7

Author : A. SidiQ P. (DnD Sandy Ra) Email : [email protected] 1. Requirements & Directory Structure Assumption Requirements :

1. Apache 2.2.1 or Latest version o Select Win32 Binary without crypto (no mod_ssl) or Win32 Binary including

OpenSSL 0.9.8r (MSI Installer) Win32 Binary Package o Url : http://httpd.apache.org/download.cgi

2. PHP 5.3 or Latest version o Select type Thread Safe installer version for Windows Win32 Binary Package o Url : http://windows.php.net/download

3. MySQL 5.5.17 or Latest version o Select Windows (x86, 32-bit), MSI Installer Win32 Binary Package o Url : http://dev.mysql.com/downloads/

4. PhpMyAdmin 3.4.7 or Latest version o Select phpMyAdmin *.zip version o Url : http://www.phpmyadmin.net/home_page/downloads.php

Directory Structure Assumption

1. Create a new directory "DnDAMPP" in drive “C: \”. This directory will be used as a place

to install Apache, PHP, MySQL, and PhpMyAdmin. 2. The directory structure will be as shown below :

C:\

.\Program Files

.\Windows

.\User

.\DnDAMPP ..\Apache2.2

..\MySQL

..\PHP

…\phpmyadmin

Lisensi Dokumen: Copyright © 2011 sq.web.id Seluruh dokumen di sq.web.id dapat digunakan, dimodifikasi dan disebarkan secara bebas untuk tujuan pendidikan (bukan komersial (nonprofit)), dengan syarat tidak menghapus atau merubah atribut penulis dan pernyataan copyright yang disertakan dalam setiap dokumen.

Page 2: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 2

Page 3: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 3

2. Apache

1. Double click the installer (*.msi file, example : httpd-2.2.21-win32-x86-openssl-0.9.8r.msi). You will see a window that looks like this :

2. Click the “Next >” button. 3. Check the radio button "I accept the terms in the license agreement", and then click the

“Next >” button. 4. On the next window, again click the "Next >" button.

Now see the below image to fill the server information, and fill in all the text boxes with the following information:

Network Domain : localhost

Server Name : localhost

Administrator's Email Address : [email protected] or your email address

Check the radio button “for All Users, on Port 80, as Services – Recommended. and then click the “Next >” button.

Page 4: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 4

5. On the window “Apache HTTP Server 2.2 – Installation Wizard – Destination Folder”, click the “Change” button, and navigate to ".\DnDAMPP" directory under drive “C:\” (example : “C:\DnDAMPP\Apache2.2\”), and then click the “Next >” button.

6. On the next window, click the radio button "Custom", and then click the "Next >" button. 7. The next step wait for the finished installation.

Page 5: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 5

8. To complete the installation process click the "Finish" button. You should see a window that looks like this :

9. To ensure that the apache installation has been done can work well, the next step open your favorite browser and type “ http://localhost ” in the address bar and press the button enter on the keyboard. If you will see “It works!” then your apache works fine.

Page 6: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 6

3. PHP

1. Double click the installer (*.msi file, example : php-5.3.8-Win32-VC9-x86.msi). You will see a window that looks like this :

2. On the next window, click the “Next >” button. 3. Check the radio button "I accept the terms in the license agreement", and then click the

“Next >” button. 4. On the next window, again click the "Next >" button. 5. On the window “PHP 5.3.8 Setup – Destination Folder”, click the “Browse…” button, and

navigate to "DnDAMPP" directory under drive “C:\” (example : “C:\DnDAMPP\PHP\”), and then click the “Next >” button.

Page 7: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 7

6. On the window “PHP 5.3.8 Setup – Web Server Setup”, click the radio button “Apache 2.2.x Module”, and then click the “Next >” button.

7. On the window “PHP 5.3.8 Setup – Select Apache Configuration Directory”, click the “Browse…” button, and navigate to ".\DnDAMPP\ Apache2.2\" directory under drive “C:\” (example : “C:\DnDAMPP\Apache2.2\conf”), and then click the “Next >” button. See the below image :

Page 8: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 8

8. On the next window, click the "Next >" and “Install” button. 9. The next step wait for the finished installation. 10. To complete the installation process click the "Finish" button. You should see a window that

looks like this :

11. Restart your apache server,if your are getting any error just reboot your PC. 12. To ensure that the PHP installation has been done can work well, and then the next step

open your favorite text editor (example : Geany, Notepad, Intype, Etc) and copy/paste below code into it :

<?php

phpinfo()

?>

Page 9: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 9

and then save as this file "phpinfo.php" in your apache document root directory (example : “C:\DnDAMPP\Apache2.2\htdocs”).

13. The next step open your favorite browser and type “ http://localhost/phpinfo.php ” in the address bar and press the button enter on the keyboard. If you will see the below page , then your PHP works fine.

Page 10: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 10

4. MySQL

1. Double click the installer (*.msi file, example : mysql-installer-5.5.17.0.msi), you will see there are three main options :

a. Install MySQL Products - The Installation Wizard. b. About MySQL - Learn about MySQL products and features. c. Resources - Information to help install and configure MySQL.

and then select “Install MySQL Product”.

2. Check the checkbox "I accept the the license terms", and then click the “Next >” button. 3. In the window “MySQL Installer - Find Latest Product” Check the checkbox “Skip the check

for updates (not recommended)”, and then click the “Next >” button. 4. In the window “MySQL Installer - Setup Type”,

a. Click the radio button “Developer Default”, b. On dialog “Installation Path” click the “…” button, and navigate to "DnDAMPP"

directory under drive “C:\” (example : “C:\DnDAMPP\MySQL\”), and then click the “Next >” button.

5. On the next window “MySQL Installer - Check Requirements”, and then click the “Next >” button.

6. On the next window “MySQL Installer - Installation”, you will be able to view a list of the MySQL components that are scheduled to be installed. Click the “Execute” button to install MySQL components.

7. The next step wait for the finished installation. 8. After finished installation, the next step is configuration.

Page 11: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 11

a. You can watch the progress of this step in the “MySQL Installer – Configuration” window, and then click the “Next >” button.

b. On the next window “MySQL Installer - MySQL Server Configuration”, click the radio button “Developer Machine”, and then click the “Next >” button.

c. Next, choose your basic Network, Windows, and Security Settings, and then click the “Next >” button.

9. To complete the installation process click the "Finish" button. You should see a window that looks like this :

Page 12: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 12

10. To ensure that the MySQL installation has been done can work well, and then the next step open your MySQL Command Line Client. To open MySQL Command Line Client Go to Start Menu All Programs MySQL MySql Server 5.5 MySQL 5.5 Command Line Client.

11. If you have seen window “MySQL 5.5 Command Line Client”, type your password in dialog “Enter password” and press the button enter on the keyboard. If you will see the below page , then your MySQL works fine.

Page 13: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 13

5. PhpMyAdmin

Installation phpMyAdmin

1. Extract the zip archive (example : phpMyAdmin-3.4.7.1-all-languages.zip) to ".\DnDAMPP\ Apache2.2\htdocs" directory under drive “C:\” (example : “C:\DnDAMPP\Apache2.2\htdocs”). See the below image :

2. Rename the “phpMyAdmin-3.4.7.1-all-languages” directory to “phpmyadmin”.

3. Now open “httpd.conf” file in “C:\DnDAMPP\Apache2.2\conf\” directory a. Find these lines :

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

Add “index.php” after the “index.html“ and it looks like this :

Page 14: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 14

<IfModule dir_module> DirectoryIndex index.html index.html.var index.php

</IfModule>

b. In the last line, add the following :

<IfModule mod_alias.c> Alias /phpMyAdmin "C:/DnDAMPP/Apache2.2/htdocs/phpMyAdmin"

</IfModule> <Directory "C:/DnDAMPP/Apache2.2/htdocs/phpMyAdmin">

Options None AllowOverride None order deny,allow

deny from all allow from 127.0.0.1

</Directory>

4. Restart your apache server. 5. The next step open your favorite browser and type “ http://localhost/phpmyadmin ” in the

address bar and press the button enter on the keyboard. If you will see the below page, then your phpMyAdmin works fine.

6. If you can access phpMyAdmin, type your username and password in dialog “Log in” and click the button “Go”. You should see a window that looks like this :

Page 15: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 15

7. Please go to bottom page, you can see message which states the configuration has not been completed.

Configure phpMyAdmin 1. Edit phpMyAdmin's default configuration “config.sample.inc.php“ file in

“C:\DnDAMPP\Apache2.2\htdocs\phpMyAdmin\” directory, rename it to “config.inc.php”. 2. Copy this code and replace your “config.inc.php” configuration.

<?php

/*

* This is needed for cookie based authentication to encrypt password in * cookie

*/ $cfg['blowfish_secret'] = 'dnd'; /* YOU MUST FILL IN THIS FOR COOKIE

AUTH! */ /*

* Servers configuration */ $i = 0;

$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE; /*

Page 16: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 16

* First server */

$i++; /* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'http'; $cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = '[Your Password]'; $cfg['Servers'][$i]['auth_type'] = 'config';

/* Select mysqli if your server has it */

$cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['AllowNoPassword'] = false;

/* * phpMyAdmin configuration storage settings. */

/* User used to manipulate with storage */

$cfg['Servers'][$i]['auth_type'] = 'http'; $cfg['Servers'][$i]['user'] = ''; $cfg['Servers'][$i]['password'] = '';

$cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info';

$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info';

$cfg['Servers'][$i]['history'] = 'pma_history'; $cfg['Servers'][$i]['tracking'] = 'pma_tracking';

$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig'; /* Contrib / Swekey authentication */

// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf'; /*

* End of servers configuration */

/* * Directories for saving/loading files from server

*/ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = '';

?>

Note :

$cfg['Servers'][$i]['password'] = '[Your Password]';

[Your Password] replace your password to access MySQL.

Page 17: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 17

3. Next step, Create MySQL's phpMyAdmin controluser user 'pma@localhost' with password 'pmapass', with the proper permissions set.

a. Open MySQL Command Line Client Go to Start Menu All Programs MySQL MySql Server 5.5 MySQL 5.5 Command Line Client.

b. If you have seen window “MySQL 5.5 Command Line Client”, type your password in dialog “Enter password” and press the button enter on the keyboard.

c. And then Run this SQL code one by one :

mysql> GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY

'pmapass'; mysql> GRANT SELECT (Host, User, Select_priv, Insert_priv,

Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv,

Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv) ON mysql.user TO 'pma'@'localhost';

mysql> GRANT SELECT ON mysql.db TO 'pma'@'localhost';

mysql> GRANT SELECT ON mysql.host TO 'pma'@'localhost'; mysql> GRANT SELECT (Host, Db, User, Table_name, Table_priv,

Column_priv) ON mysql.tables_priv TO 'pma'@'localhost';

d. Run phpMyAdmin's sql script file 'create_tables.sql' and then grant permissions.

mysql> source C:\www\phpMyAdmin\scripts\create_tables.sql mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO

'pma'@'localhost'; mysql> quit

4. After completion of your configuration, please logout from phpmyadmin and login again.

Page 18: How to Install Apache - PHP - MySQL - Php My Admin on Windows 7

SQ – http://sq.web.id – 18

6. Directory To Save The Program PHP and MySQL MySQL

If you create databases and tables with MySQL, then by default your database will be stored in a directory “C:\ProgramData\MySQL\MySQL Server 5.5\data”.

PHP

If you create a program with PHP, so can be run on localhost, then it must be stored in ".. \htdocs" directory.

o “C:\DnDAMPP\Apache2.2\htdocs\”