ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Internet & the Web

How to Install and configure the settings for a web server, PHP, and the MySQL database for Drupal Part-1

Updated on May 24, 2014

Installing an Apache, MySQL, and PHP stack

Although you can use a number of different web servers and databases, we are going to
use the commonly used combination of Apache, MySQL, and PHP, often referred to as the *AMP stack.

Mac OS X AMP stack

For Mac OS X, we will use the MAMP package to install an AMP stack.

downloading the latest version of MAMP

1. First, download MAMP from http://www.mamp.info/en/downloads/index.
html. Once MAMP has completed downloading, double-click on the downloaded
.zip file, expand the 64bit folder, and then double-click the MAMP.pkg file. This will
launch the MAMP installer.

2. Next, click on Continue on this screen and the next screen, then click on Continue,

and click on Agree to agree to the terms of the software license agreement, and
then click on Continue once again on the next screen. It is important on the next
screen to click on the Customize button, and on the very next screen, un-check the
MAMP Pro 2.0.1 checkbox.

3. After that, click on Install. After the installation completes, click on Close. Go to your Applications folder and the MAMP folder, and double-click on the MAMP application. After the Apache and MySQL servers have started, you will see the following MAMP start screen load in your default web browser:

Windows AMP stack

For Windows, we will use XAMPP.

1. First, download XAMPP from http://www.apachefriends.org/en/xampp-windows.html.
Scroll down the page until you get to the XAMPP for Windows section,
and click on the Zip download. After the xampp-win32-1.7.4-VC6.zip
file has completed downloading, right-click on it and select Extract All…,
enter C:\ as the destination, and click on Extract.
Note that the extraction process will take a few minutes.

2. Now, navigate to the C:\xampp directory, and double-click on the xampp-control

application to start the XAMPP Control Panel Application.

3.Inside the XAMPP Control Panel Application, click on the Start buttons next toApache and MySQL. Now, open up your favorite web browser, navigate to http://localhost

4.There is one last step with XAMPP before we move on; we need to set the admin password for MySQL. In your favorite web browser, open http://localhost/security/index.php

5.Enter the new password as root, and click on the Password changing button to submit the change. You should see the following message:

The root password was successfully changed. Please restart MYSQL for loading these changes!


What just happened?

Congratulations! You now have a working AMP stack installed.

PHP configuration

Drupal 7 recommends PHP version 5.3. The latest version of MAMP includes PHP version
5.3.6 (it also includes PHP version 5.2.13, and allows you to switch between them). The latest version of XAMPP for Windows includes PHP version 5.3.5. Although this version of PHP
meets the requirements of Drupal 7, there are some PHP-related settings that need to be tweaked before we install Drupal, to ensure that things will run smoothly.

modifying php.ini settings

Mac OS X: Use your favourite text editor to open the php.ini file located at /Applications/ MAMP/bin/php/php5.3.6/conf. If you are using Apple's TextEdit application, then
I recommend that you take a look at Smultron - http://www.peterborgapps.com/
smultron/, which is inexpensive and available in the Mac App Store. Other favourite text
editors for the Mac include Text Mate - http://macromates.com/ and Coda - http:// panic.com/coda/, among many others.


Windows: Use your favourite text editor to open the php.ini file located at C:\xampp\php. I like Sublime Text and Notepad++.


Navigate to the Resource Limits section, and edit the settings to match the following values:

max_execution_time = 60;
max_input_time = 120;
memory_limit = 128M;
error_reporting = E_ALL & ~E_NOTICE

Drupal 7 is a bit slower in some ways than Drupal 6. So, it is important that you make these changes to the php.ini file for your Drupal 7 development site to run smoothly.

MySQL configuration

Although it is possible to run Drupal 7 on several different databases, including some
NoSQL databases (such as Mongo DB), we will use the most commonly used database,
MySQL. For Drupal 7, MySQL version 5.0.15 or higher is recommended, and both of the AMP stacks chosen for Mac OS X and Windows include MySQL versions higher than
that. Now, let's tweak some MySQL configuration settings to ensure a smooth running
development environment.

modifying the MySQL my.cnf settings

Mac OS X: MAMP does not use a my.cnf file by default. So you must copy the file at /Applications/MAMP/Library/support-files/my-medium.cnf to /
Applications/MAMP/conf/my.cnf (notice the new name of the file).

Windows: For XAMMP, open the my.ini file located at C:\xampp\mysql\bin.

Open the my.cnf/my.ini file in your text editor, and find and edit the following settings to match these values:

# * Fine Tuning
#

key_buffer = 16M

key_buffer_size = 32M

max_allowed_packet = 16M
thread_stack = 512K
thread_cache_size = 8
max_connections = 300

One of the real gotchas for the Drupal MySQL configuration is the max_allowed_packet setting. This has always been a source of bewildering errors in the past for myself and
many other Drupal developers that I know, and it is a setting that is specifically mentioned on the http://drupal.org/requirements# database page, under the Database
server section.

creating an empty MySQL database

Before we can install Drupal, we need to create a new and empty MySQL database.

Both MAMP and XAMPP include phpMyAdmin—a web-based administration tool
for MySQL. We will use phpMyAdmin to create an empty database for Drupal.

Mac OS X: With MAMP running, open your favorite web browser, and go to http://localhost:8888/phpMyAdmin.

Windows: With XAMPP running, open your favorite web browser, and go to http://localhost/phpmyadmin/.

You will see the following screen:

The default page of phpMyAdmin includes a form for creating a database as shown. Enter the
name d7dev for your database, and click on Create. You will then see the following screen:

What just happened?

You have installed a fully-functional AMP stack that has been configured specifically for Drupal,
and you have created an empty MySQL database as a preliminary step for installing Drupal.

Installing Git

Git is a source control and versioning software that has become very popular over the last
few years. In February of 2011, drupal.org migrated from the outdated CVS versioning
system to Git. The migration to Git has enabled a completely new way for Drupal developers
to interact with drupal.org, and we will highlight this enhanced interaction throughout
the book. However, we will also immediately start using Git to facilitate setting up a Drupal
development environment. So, if you don't already have Git installed on your computer, let's
get it set up.

installing Git for Mac OS X

To install Git for the Mac, we are going to use Homebrew (an open source package manager for Mac OS X) with installation instructions available at https://github.com/mxcl/ homebrew/wiki/installation.

1. Once you have Homebrew installed, installing Git is as easy as opening up
the Terminal application (in /Applications/Utilities), and typing
the following command:


brew install Git


2. Type the following to see if it worked:


Git version

installing Git for Windows

For Windows, we are going to use msysgit available at http://code.google.com/p/ msysgit/downloads/list.

1. Download the most recent version of the full installer for the official Git, currently
Git-1.7.6-preview20110708.exe, and then double-click on the downloaded
file link to begin the installation process.

2. Click on Next, and then click Next again on the GNU General Public License screen.

3. On the Select Destination Location screen, click on Next to accept the
default destination.

4. On the Select Components screen, accept the defaults again, and click on Next.

5. On the Adjusting your PATH Environment screen, select Run Git and included Unix tools from the Windows Command Prompt as this will allow Git to work with Drush, which we will cover next.

Conclusion

I hope this tutorial will help you on next day i am going to tell you how to install Drush , drupal and many more.This is my 1 topic so if any suggestion regarding this topic drop a comment.Thank you.

If you like this topic then give a vote

See results

© 2014 Rohit Bhattacharjee

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.