how to install apache - php - mysql - phpmyadmin on windows 7

Upload: john07bbb

Post on 07-Aug-2018

239 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    1/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 versiono  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.

    mailto:[email protected]:[email protected]:[email protected]://httpd.apache.org/download.cgihttp://httpd.apache.org/download.cgihttp://httpd.apache.org/download.cgihttp://windows.php.net/downloadhttp://windows.php.net/downloadhttp://windows.php.net/downloadhttp://dev.mysql.com/downloads/http://dev.mysql.com/downloads/http://dev.mysql.com/downloads/http://www.phpmyadmin.net/home_page/downloads.phphttp://www.phpmyadmin.net/home_page/downloads.phphttp://www.phpmyadmin.net/home_page/downloads.phphttp://www.phpmyadmin.net/home_page/downloads.phphttp://dev.mysql.com/downloads/http://windows.php.net/downloadhttp://httpd.apache.org/download.cgimailto:[email protected]

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    2/18

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

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    3/18

    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.

    mailto:[email protected]:[email protected]:[email protected]:[email protected]

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    4/18

    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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    5/18

    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.

    http://localhost/http://localhost/http://localhost/http://localhost/

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    6/18

    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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    7/18

    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 :

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    8/18

    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 :

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    9/18

    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.

    http://localhost/phpinfo.phphttp://localhost/phpinfo.phphttp://localhost/phpinfo.phphttp://localhost/phpinfo.php

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    10/18

    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 click the link “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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    11/18

    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 :

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    12/18

    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 StartMenu 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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    13/18

    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 :

    DirectoryIndex index.html

     

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

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    14/18

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

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

    b. 

    In the last line, add the following :

    Alias /phpMyAdmin "C:/DnDAMPP/Apache2.2/htdocs/phpMyAdmin"

    Options NoneAllowOverride Noneorder deny,allowdeny from allallow from 127.0.0.1

     

    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 :

    http://localhost/phpmyadminhttp://localhost/phpmyadminhttp://localhost/phpmyadminhttp://localhost/phpmyadmin

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    15/18

    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. 

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    16/18

    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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    17/18

    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.sqlmysql> 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.

  • 8/19/2019 How to Install Apache - PHP - MySQL - PHPMyAdmin on Windows 7

    18/18

    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\”