Monday, August 10, 2015

Quick Steps for Drupal Installation


Steps for Drupal Installation
1. Install XAMPP in C drive.
2. Start Apache (Web server) and MySQL (database server) services from the XAMPP control panel.
3. Save drupal version in C:\xampp\htdocs.
4. When you unzip the download of Drupal, it will probably create a directory called "drupal-6.17" (or whatever the latest version of Drupal is). Possibly rename this directory to "drupal", so you can access your local Drupal install at http://localhost/drupal.
5. In a web browser, go to http://localhost/phpmyadmin.
6. Click on the Privileges tab to create a new database user for Drupal. Choose the name "drupal", select "localhost" for host, and enter your password (twice). Choose the option to create a new database with the same name and grant all privileges.
7. Copy & paste the file "default.settings.php" in "c:\xampp\htdocs\drupal\sites\default", under the drupal directory, and name it "settings.php".
You should now have two identical files in your "c:\xampp\htdocs\drupal\sites\default" folder -- one called "settings.php" and one called "default.settings.php".
8. You should now have two identical files in your "c:\xampp\htdocs\drupal\sites\default" folder -- one called "settings.php" and one called "default.settings.php".
9. Follow the instructions in http://localhost/drupal and install the setup completely.
Url for downloading installable : http://drupal.org/node/307956


Tips to improve the C# & ASP .Net performance improvement

Following are few tips to improve the C# & ASP .Net performance improvemnt:
1.       Running the profiler on several Application files individually.

2.       Introducing a Helper Class to debug and provide resource utilization of each function\methods

3.       Caching at content management level & caching at MVC website level needs to be evaluated.

4.       If there are file Download mechanism then it needs to be verified. There are open source that do better job.

5.       Can the pool size be increased to serve more number of request? Whether the connection release is happening properly.

6.       Enablement of recycling of .Net Application pool.

7.       Analyzing Clustered Index and Non-Clustered Indexes on the DB

8.       Usage of static methods & static variable needs to be verified. Issue with the static is that one can add objects to static data structure without removing it & hence bloating the memory.

9.       Whether some mechanism of the Garbage collection has been implemented?

10.   Whether some shared resource is there for multiple threads. In java it is Synchronized resources. This makes the tread to wait & hence increase the CPU usage. Can the tread pool size be increased?

11.   It is very easy to concatenate the Strings in C# - you need just “+” (plus) operator to do it but there are few drawbacks in this. One should know that String object is immutable in C#, once created they cannot be changed anymore. Whenever you are concatenating a String, the old one is getting dropped and new concatenated one is getting created which slow up the performance significantly. So, one should look up for StringBuilder to enhance the performance. Use the System.Text.StringBuilder class to perform the concatenations instead of using the “+” concatenation operator or String.Concat, since this class has been optimized for string concatenation. The buffer size will get changed automatically (if required) and length will also get tracked. This needs to be done where the variable scope is within the method.
When to use “+” (plus) or String.Concat ()

Security Issue: When one don’t want to change the value of String. Actually, Immutable makes things easier. When one is passing a String to function you can be very sure that its value will not get changed, so it helps in bypassing the security.

Small Operation: When you are doing Concatenation for couple of strings then we can go for “+” (plus) or String.Concat ().

When to use StringBuilder

Inside loop: Whenever one is appending the String inside the loop, one should go for StringBuilder to enhance the performance. Even, if one is appending the Strings over and over again, then you should go for StringBuilder.

12.   Say NO to Generic Exceptions. Error handling is always better but should be used with care. It is a costly resource and must be avoided as possible. Catch specific exceptions with precise details always rather using a root top level Exception class to catch everything. Such as catching an IOException is better instead of Exception e.

13.   As in the Java there is heap size which can be increased  to accommodate more objects & improve the performance. What is equivalent of this in the C# & ASP .Net?

14.   There few ways to do IIS performance tuning:   HTTP Compression, Limiting Connections, Configuring Application Pool Queue-Length . This is the low hanging fruit.

15.   I have asked the customer to increase the CPU. If he refuses then please introduce one infra architect also to look for optimizing the OS page size, RAM Cache. He will also look into optimizing the HTTP request for the firewalls, optimize CPU Share Allotment For A process. Also, based on the I/O Statistics ,split the subdisks in the volume and to move those regions to a less busy disk.


Drupal Multi Node Installation

DRUPAL INSTALLATION STEPS
System requirements:
·         Resources :  A minimum base installation requires at least 3MB of disk space
·         Web Server : Drupal has been successfully deployed on both Apache and IIS, but Apache is recommended. Drupal will work on Apache 1.3 or 2.x hosted on unix/linux, os x or windows.
·         Database Server : MySQL/PostgreSQL/SQLite. MySQL 4.1 or 5.0 is recommended.
·         PHP :  Recommended – 5.2.x
o   The PHP extension for connecting to your chosen database must be installed and enabled. Drupal's currently supported database connectors are: mysql (the original MySQL extension), mysqli (an improved connector for newer MySQL installations), and pgsql (for PostgreSQL).
Installation Steps:

1.       Install Apache 2.2 until below screen appears and enter the given values:






2.       To make sure Apache is working now you need to open your browser window and type http://localhost as the address, and if you get the same message like below image that mean apache is working. If both IIS and apache are running, it is recommended to disable IIS and restart apache.



3.       We need to configure apache so it’ll recognize the php files and can parse the php files correctly. And the first thing to do is extracting the PHP zip archive, say in c:\php.

4.       After finished with the extraction process, now we need to go to the Apache installation path, and then open httpd.conf which is located under the conf directory

5.       In order for apache to parse the php files correctly, first you need to Load the PHP5 module into the Apache, and to do this you just need to add below line to your Apache httpd.conf (after the last line of the loadmodule section) :
LoadModule php5_module "c:/php/php5apache2_2.dll"



6.       Add these lines inside the directive (before the closing
for mime_module):
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

7.       We need to configure apache so it’ll check the existence of index.php by default too instead of just checking the index.html only for the default index filename. Do it by replacing DirectoryIndex index.html by DirectoryIndex index.html index.php.
The default configuration from Apache 2.2:

DirectoryIndex index.html

The modified version:

DirectoryIndex index.html index.php

Apache is now configured. Now we need to configure php.
8.       Copy php.ini-recommended from php directory into C:\Windows and then rename it to php.ini’
9.       Open the php.ini file using notepad and change the extension_dir to “c:\php\ext”.
10.   Now copy all dlls from your php directory into C:\Windows\System32, all except those starting from php5*.dll.
11.   Create a file named test.php inside C:\Program Files\Apache Software Foundation\Apache2.2\htdocs
12.   Add below line to the test.php file then save and close the notepad.



echo "Hello World";
?>


13.   Now open the command prompt and type the following to restart the apache process:
Net stop apache2.2 && net start apache2.2
14.   Now after finished restarting the apache process, we need to open the browser window and point to http://localhost/test.php
15.   Copy the Drupal folder to C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and in the browser window enter http://localhost/drupal to start using Drupal.
Drupal is now configured.

Installing MYSQL:
Next we will be installing MySQL version 5. Follow the steps carefully.
1.     Extract mysql-5.0.27-win32.zip using WinZIP or a similiar program.
2.     Once extracted, double click on the "Setup.exe" file. An installation wizard will appear.



Click "Next".
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".
20.  To test if MySQL was installed correct, go to: Start > All Programs > MySQL > MySQL Server 5.0 > MySQL Command Line Client. The MySQL Command Line Client will appear:


21.  It will ask you for a password. Enter the password you created in step 18. (If you enter an incorrect password MySQL will automatically close the command line)



22.  Next, type in the commands shown above hown in blue)




 

If you don't get any errors, and it returns the information shown above, then MySQL has been successfully installed! Next we will need to configure PHP to work with MySQL.
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.
4.     Create a new file in your "htdocs" directory called "mysql_test.php".
5.     Copy the following code into "mysql_test.php" and click save. (Make sure to replace the MYSQL_PASS constant with the MySQL Password you specified during the MySQL installation).

# Define MySQL Settings
define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PASS", "password");
define("MYSQL_DB", "test");

$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());

$sql = "SELECT * FROM name";
$res = mysql_query($sql);

while ($field = mysql_fetch_array($res))
{
$id = $field['id'];
$name = $field['name'];

echo 'ID: ' . $field['id'] . '
';
echo 'Name: ' . $field['name'] . '

';
}

?>
6.     Open up Internet Explorer and type in "http://localhost/mysql_test.php". If the "mysql_test.php" page returns something similiar to:
ID: 1
Name: John
Then PHP & MySQL have been successfully configured to work together. Congratulations! The next and final step is to install phpMyAdmin.
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.     UnZip the  file phpMyAdmin-2.11.10-english.zip
2.     Create a new folder called "phpmyadmin" in your "htdocs" directory. Extract the contents of the "phpMyAdmin-2.9.2-english.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:

/* $Id: config.sample.inc.php 9675 2006-11-03 09:06:06Z nijel $ */
// vim: expandtab sw=4 ts=4 sts=4:

/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use scripts/setup.php
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki .
*/

/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
* Servers configuration
*/
$i = 0;

/*
* First server
*/
$i++;

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'YOUR_PASSWORD_HERE'; // Your MySQL Password


/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'YOUR_PASSWORD_HERE'; // Your MySQL Password
/* Advanced phpMyAdmin features */
$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';

/*
* End of servers configuration
*/

/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

?>

  1. phpMyAdmin has now been successfully installed!

Create database and user using PHPMyAdmin

This presumes you have root access to PHPMyAdmin
  1. Log in to PHPMyAdmin as the root user
  2. Click Privileges & Add a new User
  3. In the User name field, enter the username you wish to use
  4. In the Host field, select Local which is more secure, unless you will be accessing the database with this user from another server
  5. Enter or generate a password for the user.
  6. In the Database for User list, select Create database with same name and grant all privileges and click Go

Settings.php

1.      Make a file "settings.php" C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\default
2.      Copy the content of  default.settings.php from the location C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\sites\default into "settings.php"(Do not rename the "default.settings.php" file to "settings.php". Just copy it. You need 2 files in your default directory;)
Run the installation script
To run the install script point your browser to the base URL of your website http://localhost/drupal




You will be guided through several screens to set up the database, create tables,


add the first user account and provide basic web site settings.


Once guided through these Step the Drupal Installation will be completed.

For Further Reference

http://drupal.org/node/540242
http://bytes.com/topic/cms/answers/879944-how-configure-drupal-database-settings-during-installation



Following are the default items that comes with drupal