Wednesday 8 January 2014

Configuring Apache, MySQL, PHP, and PHPMyAdmin

It is also a result of internet surfing, so i am sharing.

phptriad is a great tool. Just double-click the installer to install this tool and in next 2-3 minutes, you are ready with a web development/deployment environment. WAMP and many other clones came up.

But configuring four of them yourself gives you more control over the development environment. You have the option of choosing latest versions of these software according to your platforms.

This configuration is easy if every step is followed carefully with no shortcuts, slips, and oversights.

I have taken below stated steps from one of my trainees' report and he might have taken from some website only. But, the thing is that these steps are complete and worked for me everytime; so these should work for you also.

Just try...
The Apache Server combined with the power of PHP, MySQL, and phpMyAdmin, creates one of the best possible development environments for a web programmer. Getting everything properly configured can take 20-30 minutes, so make sure you have enough time set aside before beginning the installation.

Installing Apache:
Go to www.apache.org and download "Win32 Binary (MSI Installer): apache_2.2.8-win32-x86-openssl-0.9.8g.msi to your desktop.
1. Double click "apache_2.2.8-win32-x86-openssl-0.9.8g.msi", and if prompted, click "run".
2. An installation wizard will appear.Click "Next".
3. The next page contains the terms of agreement. Select "I accept", and click "Next".
4. Read about the Apache Server, and click "Next"
5. The next screen will ask you for specific server information.Click "Next".
6. On the next screen, select "Typical Installation" and click "Next".
7. Click "Next".
8. Click "Install".
9. Open up Internet Explorer and type in "http://localhost". If you see a page that says "It works!" then the Apache server has been installed successfully.


Installing PHP:
1. Go to www.php.net and download the "PHP 5.2.0 zip package" to your desktop. (Be patient while it downloads, the ZIP file is over 9MB!)

Create a new folder called "php" in your C Drive. Copy the "php-5.2.0-Win32.zip" file to there ("C:\php") and extract it using WinZIP or a similiar program.
2. Your "C:\php" directory should now look like:
3. Next copy the "php.ini-dist" file from "C:/php/" to "C:/WINDOWS" and rename it to "php.ini". This is your PHP configuration file. We'll come back to this later.
4. Now it's time to tell Apache that PHP exists. Open up your Apache configuration file ("C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf") in notepad and add these four lines to the bottom of the "LoadModule" section:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "c:/windows"
5. In your "htdocs" directory, create a file called "info.php". Open it in notepad and add this line of code to it:

6. Restart your Apache Server for the changes to take effect: Start > All Programs > Apache HTTP Server 4.2.4 > Control Apache Server > Restart
7. Open up Internet Explorer and type in: http://localhost/info.php. If your browser takes you to a page that looks like this, then PHP has been installed successfully!
Modifying your PHP Configuration File:
• Your PHP configuration (php.ini) file is located in "C:/WINDOWS/php.ini". You can modify it with notepad or a similiar text editor.
• Open it up and find the line that says:
extension_dir = "./" and change it to
extension_dir = "C:\php\ext"
• Find the line that says:
;session.save_path = "/tmp" and change it to
session.save_path = "C:\WINDOWS\temp"

Installing MYSQL:
1. Go to www.mysql.com and download the "Windows (x86) Setup.EXE (version 5.0.27)" to your desktop. (To do this you'll need to register an account with MySQL.).
2. Double click on the "Setup.exe" file. An installation wizard will appear.
3. Select "Typical" Installation and click "Next".
4. Click "Install". (Be patient, this can take up to several minutes).
5. The next screen will ask you to "Sign Up". Select "Skip Sign-Up" for now.
6. The next screen will tell you that the installation wizard is complete. Make sure that the "Configure the MySQL Server now" field is checked before clicking "Finish".
7. The MySQL Server Instance Configuration Wizard should appear. Click "Next".
8. Select "Detailed Configuration" and click "Next".
9. Select "Developer Machine" and click "Next".
10. Select "Multifunctional Database" and click "Next".
11. Click "Next".
12. Select "Decision Support (DSS)/OLAP" and click "Next".
13. Select "Multifunctional Database" and click "Next".
14. Make sure "Enable TCP/IP Networking" is checked, the Port Number is set to "3306", and "Enable Strict Mode" is checked. Click "Next".
15. Select "Standard Character Set" and click "Next".
16. Check "Install As Windows Service", set the Service Name to "MySQL", and check "Launch the MySQL Server automatically". Make sure that the "Include Bin Directory in Windows Path" is NOT checked. Click "Next".
17. On the next screen, check the box that says "Modify Security Settings". Enter a password for the default "root" account, and confirm the password in the box below. Do NOT check the boxes "Enable root access from remote machines" or "Create An Anonymous Account". Click "Next".
18. Click "Execute". (This may take a few minutes. Be patient).
19. Click "Finish".

Configuring PHP to work with MySQL:
Now that both PHP and MySQL are installed, we have to configure them to work together.
1. Open up your php.ini file (C:/WINDOWS/php.ini) and find the line:
;extension=php_mysql.dll
To enable the MySQL extension, delete the semi-colon at the beginning of that line.
2. Next we must add the PHP directory to the Windows PATH. To do this, click: Start > My Computer > Properties > Advanced > Environment Variables. Under the second list (System Variables), there will be a variable called "Path". Select it and click "Edit". Add ";C:\php" to the very end of the string and click "OK".
3. Restart your computer for the changes to take effect

Installing phpMyAdmin:
Now that both Apache, PHP and MySQL are installed, we can install phpMyAdmin, a tool that allows you to easily manage your MySQL databases.
1. Go to www.phpMyAdmin.net and download "english.zip" under phpMyAdmin-2.11.6 section to your desktop.
2. Create a new folder called "phpmyadmin" in your "htdocs" directory. Extract the contents of the "phpMyAdmin-2.11.6.zip" ZIP file here. Your C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmyadmin" directory should now look like:
3. Create a new file in the "phpMyAdmin" directory (above) called "config.inc.php". Place this code inside it and be sure to replace "YOUR_PASSWORD_HERE" (in both places below) with your MySQL Password:
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
$i = 0;
$i++;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'YOUR_PASSWORD_HERE';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'YOUR_PASSWORD_HERE';
$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['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
4. phpMyAdmin has now been successfully installed! To use it, open up Internet Explorer and type in "http://localhost/phpmyadmin". This will bring you to the main phpMyAdmin page. If you have any questions, refer to the phpMyAdmin website or the "Documentation.html" file in the /phpMyAdmin/ directory.
5. Enjoy


No comments:

Post a Comment