Pages

Monday, January 31, 2011

WAMP (Windows 7, Apache, MariaDB or MySQL and PHPMyAdmin)

At previous post I already cover about installation steps for :
  1. Apache on Windows 7
  2. MySQL on Windows 7
  3. MariaDB on Windows 7
  4. PHP on Windows 7
If you followed all the steps then you already have complete WAMP solution for your Home Server. You can start learn PHP with your Netbook, Laptop, Personal PC  etc.
Today I want to explain about proof how those installation work together. MySQL and MariaDB by default use same port (3306). You must change port for either MySQL or MariaDB ( you can pick 3307 or 3308 for easy remembering and troubleshooting ) or you can simply uninstall MySQL or MariaDB.
Simple way that you can use to check whether all components glued is by install phpMyadmin. phpMyadmin is php application that work as layer between you and MySQL or MariaDB. You don’t have to understand SQL to use this application.If you want to mastering phpMyadmin I highly recommend you to read this book ( Mastering phpMyAdmin for Effective MySQL Management )

Install phpMyadmin on Windows 7

Download phpmyadmin
You can download latest version of phpMyadmin from this URL.
click .gz or .zip type.
New download confirmation will appear, save to my document or other place.

Unzip the file and put the folder to C:\apache\htdocs
as you see at the picture I already rename the folder to phpMyAdmin.

Open phpMyAdmin folder and rename one file (config.sample.inc.php to config.inc.php).

Testing phpMyAdmin

Open new browser session and open this URL :
http://localhost/phpMyAdmin
phpMyAdmin error : Cannot load mysql extension. Please check your PHP configuration.
Note : Its no problem if you use MySQL or MariaDB as those software created by same person and only need one extension on PHP side (mysql extension).
If you see this message it means PHP configuration need to adjust to recognize MySQL extension.
TroubleShooting mysql extension error
1. Check dll file
Go to C:\php\ext
Make sure at that folder php_mysql.dll is exist.

2. Edit php.ini file
Open php.ini file that located in C:\php with notepad.

Remove ; in front of the line to enable the extension.
3. save file.
4. Restart Apache Server
Every time you edit php.ini file you must restart the server to tell about new configuration changes.
Click Start -> Apache HTTP Server 2.2 -> Control Apache Server -> Restart

Windows Firewall may show up on Apache restart process. Just click “Allow Access” button and choose “Private networks, such as my home or work network”.

5. Open info.php file that you create in “Install PHP on Windows 7″ tutorial.

If you see this display like picture above then everything is OK.
If you don’t see it you must check for the problem.
On some case you might see this error message from log error that located on C:\Apache\logs
PHP Warning:  PHP Startup: Unable to load dynamic library ‘C:\\php\\ext\\php_mysql.dll’ – The specified module could not be found.\r\n in Unknown on line 0
Solution for this case is setting PHP path.
Setting PHP PATH on Windows 7

Open Windows Explorer and right click  above Computer icon.
Choose “Advanced system settings

Click Environment Variables.

Choose Path under System variables and click Edit button.

Add this :
C:\php;C:\php\ext;
at the end of variable value.
Click OK.

Restart your computer to see the changes.
Try open http://localhost/info.php
and check at PATH section and you’ll see the path.

Scroll down and you’ll see MySQL support like the picture above.
Open http://localhost/phpMyAdmin/index.php
You will see login page. Enter username and password and if you see phpMyAdmin page correctly it mean all component (Apache, PHP, MySQL or MariaDB) working well.
Homework
You might see this message :
Cannot load mcrypt extension. Please check your PHP configuration.
You can solve the problem with same approach as mysql extension.
See you on other post!

Step by Step Guide Install MySQL on Windows 7..........

Install MySQL on Windows 7 is another topic that I want to explain today. MySQL is common friend of Apache web server and PHP. Combination of those software powered many service and many website all over the world.
Here’s step by step guide for install MySQL server on Windows 7

Download MySQL Binary

MSI Installer vs ZIP
MSI installer highly recommended for basic user, just click next and next for install and offer shortcut for access and configuring the option.
Zip file suitable for advance user who want to configure anything by themselves.
32 bit vs 64 bit
Check your Windows 7 first. Is it 32 bit or 64 bit. If your Windows 7 has 64 bit support I highly recommend 64 bit version specially if you have memory more than 4 GB. If you only have 1 GB of RAM then I recommend you to pick 32 bit version.


Save to My Document or other place.

Install MySQL on Windows 7

Start installation process by double click installer file.
Welcome to the setup wizard for MySQL Server 5.1
Click Next.

Choose Setup Type
MySQL installer provide 3 type of setup :
  1. Typical; recommend for general use.
  2. Complete; all program features will be installed.
  3. Custom; I prefer this one because I want to specify installation folder
Choose Custom and Click Next.

Change install  location to C:\mysql\ by click Change button and enter new path. Click Next when you’re ready.

Ready to install program
Examine current setting produced by wizard. click Install to start the process.

Little advertisement from MySQL click Next.

Click Next.

Click Finish to exit the wizard.
make sure to check “configure the MySQL server now“.

Configure MySQL server on Windows 7

MySQL Server Instance Configuration Wizard will start, it will help us to configure MySQL server in easy way.
Click Next.

Select “Detailed Configuration” and click Next.

Choose “Developer Machine” for server type. It will use minimal amount of memory.
Click Next.



Select “Multifunctional Database” for database usage.
Click Next.

Click Next.

Choose “Decision Support (DSS) / OLAP” and click Next.

Choose “Enable TCP/IP Networking” and “Enable Strict Mode“.
Click Next.

Select default character set “manual” and point to UTF 8.
click Next.

Set Windows Option
Choose “Install as Windows Service” and “Include Bin Directory in Windows PATH“.
Click Next.

Set Security Settings
Enter password twice for root account.
Click Next.

Click Execute to start the wizard work for :
  • Prepare configuration
  • Write configuration file
  • Start service
  • Apply security settings

Click Finish.

Testing MySQL Server on Windows 7

Open command prompt

Issue these command to see if the server work as expected (BOLD)
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Users\LAPTOP>mysql -V
mysql  Ver 14.14 Distrib 5.1.52, for Win32 (ia32)
C:\Users\LAPTOP>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.52-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> SHOW ENGINES\G
*************************** 1. row ***************************
Engine: MyISAM
Support: YES
Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: FEDERATED
Support: NO
Comment: Federated MySQL storage engine
Transactions: NULL
XA: NULL
Savepoints: NULL
*************************** 6. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
8 rows in set (0.00 sec)
mysql>
Great. At this stage MySQL Server successfully installed with account root enabled with password. Access available via TCP/IP and optimized for developer setting.

Step by Step Guide Install MariaDB on Windows 7............

MariaDB created by Monty, Creator of MySQL.  I want to try this software on Windows 7 together with Apache and PHP. The installation process is smooth on my Windows 7 netbook.

Download MariaDB for Windows 7

Go to AskMonty for latest version of MariaDB.
MariaDB available in two version : installer and zip type.
Get installer version since this version is much smaller than zip one.

Install MariaDB on Windows 7

Double installer to start install process.
Click Next.

Click I Agree to accept License Agreement.

Destination Folder
Enter C:\mariadb as destination folder and click Next.

Click Next.

Choose “Normal” as type of install and click Install to start the process.


Installer will start to work

Completing the MariaDB 5.2.3 setup wizard.
Click Finish.

Start MariaDB on Windows 7

Open command line :

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Users\LAPTOP>cd c:\mariadb\bin
c:\mariadb\bin>net start mariadb
The mariadb service is starting..
The mariadb service was started successfully.
c:\mariadb\bin>mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.2.3-MariaDB Source distribution
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| test               |
+——————–+
3 rows in set (0.00 sec)
MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]>exit
Success. MariaDB successfully installed on my Windows 7.

Step by Step Guide Install Apache on Windows 7..........

First time I now about Apache is in 2000. I bought a few book about ASP programming and want to practice the code. My main problem is personal web server aka PWS not available for download and my study suddenly stop. No web server mean no media to process ASP code.
During my journey I found Apache web server that magically attract me to download and try perl code. “Hello world” script successfully executed and since that time I decide to use Apache for my learning friend together with PHP, MySQL and phpMyadmin.
This post is 1 st part of Home server setting. I start with how to install Apache on Windows 7.

Download Apache for Windows

At the moment Apache consist of 4 major version :

  1. Version 1.3.xx
  2. Version 2.0.xx
  3. Version 2.2.xx
  4. Version 2.3.xx
Get latest version of Apache from this URL.

Recommended version to use is version 2.2.xx . Download and save to my computer or other place.

Install Apache 2.2.17 On Windows 7

Double click installer file.
New installer wizard will show up, click Next.

License Agreement
Choose “I accept the terms in the license agreement
Click Next.

Read this First
Click Next.


You can enter “localhost” if you don’t know what to type.
Click Next.

ghjghjghj

Destination Folder
Change to C:\apache\ for easier maintenance by click Change button.
Click Next.

Ready to Install the Program
Click Install button when you’re ready to install and click Back if you want to change something.

Installation Wizard Completed
The Installation Wizard has successfully installed Apache HTTP Server 2.2.17.
Click Finish to exit the wizard.

Testing if Apache Work

Open web browser ( Firefox, Internet Explorer or Google Chrome ) and type this address :
http://localhost/