Friday, September 26, 2008

How to Install and Configure PHP 5 to Run with Apache on Windows

Many web developers want to run Apache and PHP on their own computer since it allows them to easily test their scripts and programs before they put them "live" on the Internet. This article gives a step by step guide on how you can install and configure PHP5 to work together with the Apache HTTP Server on Windows.

If you have not already installed Apache on your machine, check out one of the guides listed below. This "How To" guide assumes that you have already completed installing Apache.

Note: those planning to install PHP 4 on Apache 1.x should read my article How to Install and Configure PHP4 to Run with Apache on Windows instead.

Steps to Setting Up PHP 5

  1. Download PHP 5

    Before you begin, get a copy of PHP 5 from the PHP download page. In particular, download the zip package from the "Windows Binaries" section - that is, don't get the installer. For example, select the package labelled "PHP 5.2.5 zip package" if 5.2.5 is the current version.

  2. Install PHP 5

    Create a folder on your hard disk for PHP. I suggest "c:\php" although you can use other names if you wish. Personally though, I prefer to avoid names with spaces in it, like "c:\Program Files\php" to avoid potential problems with programs that cannot handle such things. I will assume that you used c:\php in this tutorial.

    Extract all the files from the zip package into that folder. To do that simply double-click the zip file to open it, and drag all the files and folders to c:\php.

  3. Upgraders: Remove the Old PHP.INI File from Your Windows Directory

    If you are upgrading to PHP 5 from an older version, go to your windows directory, typically c:\windows, and delete any php.ini file that you have previously placed there.

  4. Configuring PHP

    Go to the c:\php folder and make a copy of the file "php.ini-recommended". Name the new file "php.ini". That is, you should now have a file "c:\php\php.ini", identical in contents with "c:\php\php.ini-recommended".

    Note: if you are using Apache 1, you should either move the php.ini file to your windows directory, "C:\Windows" on most systems, or configure your PATH environment variable to include "c:\php". If you don't know how to do the latter, just move the php.ini file to the "c:\windows" folder. You do not have to do this if you are using Apache 2, since we will include a directive later in the Apache 2 configuration file to specify the location of the php.ini file.

    Use an ASCII text editor (such as Notepad, which can be found in the Accessories folder of your Start menu) to open "php.ini". You may need to make the following changes to the file, depending on your requirements:

    1. Enable Short Open Tags

      Search for the line that reads:

      short_open_tag = Off

      If short_open_tag is set to "off", tags like "commercial web hosts that support PHP have no issues with your scripts using "

      short_open_tag = On
    2. Magic Quotes

      By default, input data is not escaped with backslashes. That is, if your visitors enter an inverted comma (single quote) into your web form, the script will receive that unadorned inverted comma (single quote). This is for the most part desirable unless you special requirements. If you want your input data to have the backslash ("\") prefix, such as, for example, to mimic your web host's settings, search for the following:

      magic_quotes_gpc = Off

      and replace it with:

      magic_quotes_gpc = On

      Do not do this unless your web host has this setting as well. Even with the setting of "Off", you can still use the addslashes() function in PHP to add the slashes for the specific pieces of data that need them.

    3. Register Globals

      A number of older scripts assume that all data sent by a form will automatically have a PHP variable of the same name. For example, if your form has an input field with a name of "something", older PHP scripts assume that the PHP processor will automatically create a variable called $something that contains the value set in that field.

      If you are running such scripts, you will need to look for the following field:

      register_globals = Off

      and change it to the following:

      register_globals = On

      WARNING: Do NOT do this unless you have third party scripts that need it. When writing new scripts, it's best to always code with the assumption that the register_globals item is set to "Off".

    4. Display Errors

      On a "live" website, you typically want errors in your script to be silently logged to a PHP error file. On your own local machine, however, while you are testing and debugging a PHP script, it is probably more convenient to have error messages sent to the browser window when they appear. This way, you won't miss errors if you forget to check the error log file.

      If you want PHP to display error messages in your browser window, look for the following:

      display_errors = Off

      And change it to:

      display_errors = On

      This value should always be set to "Off" for a "live" website.

    5. SMTP Server

      If your script uses the mail() function, and you want the function to successfully send mail on your local machine, look for the following section:

      [mail function]
      ; For Win32 only.
      SMTP = localhost
      smtp_port = 25

      ; For Win32 only.
      ;sendmail_from = me@example.com

      Change it to point to your SMTP server and email account. For example, if your SMTP server is "mail.example.com" and your email address is "youremail@example.com", change the code to:

      [mail function]
      SMTP = mail.example.com
      smtp_port = 25
      sendmail_from = youremail@example.com

      Note that after you do this, when your script tries to use the mail() function, you will need to be connected to your ISP for the function to succeed. If you do not modify the above lines and attempt to use mail() in your script, the function will return a fail code, and display (or log) the error (depending on how you configure php.ini to handle errors).

      (Note that in Apache 1.x, the smtp_port line may not be present. If so, don't include it.)

How to Configure Apache for PHP 5

There are two ways to setup Apache to use PHP: the first is to configure it to load the PHP interpreter as an Apache module. The second is to configure it to run the interpreter as a CGI binary. I will supply information for how you can accomplish both, but you should only implement one of these methods. Choose the module method if your web host also installed PHP as an Apache module, and use the CGI method if they have implemented it to run as a CGI binary.

  1. Running PHP 5 as an Apache Module

    To configure Apache to load PHP as a module to parse your PHP scripts, use an ASCII text editor to open the Apache configuration file, "httpd.conf". If you use Apache 1.x, the file is found in "c:\Program Files\Apache Group\Apache\conf\". Apache 2.0.x users can find it in "C:\Program Files\Apache Group\Apache2\conf\" while Apache 2.2.x users can find it in "C:\Program Files\Apache Software Foundation\Apache2.2\conf\". Basically, it's in the "conf" folder of wherever you installed Apache.

    Search for the section of the file that has a series of "LoadModule" statements. Statements prefixed by the hash "#" sign are regarded as having been commented out.

    If you are using Apache 1.x, add the following line after all the LoadModule statements:

    LoadModule php5_module "c:/php/php5apache.dll"

    If you are using Apache 2.0.x, add the following line after all the LoadModule statements:

    LoadModule php5_module "c:/php/php5apache2.dll"

    If you are using Apache 2.2.x, add the following line instead:

    LoadModule php5_module "c:/php/php5apache2_2.dll"

    Note carefully the use of the forward slash character ("/") instead of the traditional Windows backslash ("\"). This is not a typographical error.

    If you are using Apache 1.x, search for the series of "AddModule" statements, and add the following line after all of them. You do not have to do this in any of the Apache 2 series of web servers.

    AddModule mod_php5.c

    Next, search for "AddType" in the file, and add the following line after the last "AddType" statement. Do this whichever version of Apache you are using. For Apache 2.2.x, you can find the "AddType" lines in the section. Add the line just before the closing for that section.

    AddType application/x-httpd-php .php

    If you need to support other file types, like ".phtml", simply add them to the list, like this:

    AddType application/x-httpd-php .phtml

    Finally, for those using one of the Apache 2 versions, you will need to indicate the location of your PHP ini file. Add the following line to the end of your httpd.conf file.

    PHPIniDir "c:/php"

    Of course if you used a different directory for your PHP installation, you will need to change "c:/php" to that path. Remember to use the forward slash ("/") here again.

    If you are using Apache 1, you will have already placed your php.ini file in either the Windows directory or somewhere in your PATH, so PHP should be able to find it by itself. You can of course do the same if you are using Apache 2, but I find modifying the Apache configuration file a better solution than cluttering your c:\windows directory or your PATH variable.

  2. Running PHP 5 as a CGI Binary

    If you have configured PHP 5 to run as an Apache module, skip forward to the next section. This section is for those who want to configure PHP to run as a CGI binary.

    The procedure is the same whether you are using the Apache 1.x series or one of the 2.x series.

    Search for the portion of your Apache configuration file which has the ScriptAlias section. Add the line from the box below immediately after the ScriptAlias line for "cgi-bin". If you use Apache 2.2.x, make sure that the line goes before the closing for that section.

    Note that if you installed PHP elsewhere, such as "c:\Program Files\php\", you should substitute the appropriate path in place of "c:/php/" (for example, "c:/Program Files/php/").

    ScriptAlias /php/ "c:/php/"

    Apache needs to be configured for the PHP MIME type. Search for the "AddType" comment block explaining its use, and add the AddType line in the box below after it. For Apache 2.2.x, you can find the AddType lines in the section. Add the following line just before the closing for that section.

    AddType application/x-httpd-php .php

    As in the case of running PHP as an Apache module, you can add whatever extensions you want Apache to recognise as PHP scripts, such as:

    AddType application/x-httpd-php .phtml

    Next, you will need to tell the server to execute the PHP executable each time it encounters a PHP script. Add the following somewhere in the file, such as after the comment block explaining "Action". If you use Apache 2.2.x, you can simply add it immediately after your "AddType" statement above; there's no "Action" comment block in Apache 2.2.x.

    Action application/x-httpd-php "/php/php-cgi.exe"

    Note: the "/php/" portion will be recognised as a ScriptAlias, a sort of macro which will be expanded to "c:/php/" (or "c:/Program Files/php/" if you installed PHP there) by Apache. In other words, don't put "c:/php/php.exe" or "c:/Program Files/php/php.exe" in that directive, put "/php/php-cgi.exe".

    If you are using Apache 2.2.x, look for the following section in the httpd.conf file:


    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

    Add the following lines immediately after the section you just found.


    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
  3. Configuring the Default Index Page

    This section applies to all users, whether you are using PHP as a module or as a CGI binary.

    If you create a file index.php, and want Apache to load it as the directory index page for your website, you will have to add another line to the "httpd.conf" file. To do this, look for the line in the file that begins with "DirectoryIndex" and add "index.php" to the list of files on that line. For example, if the line used to be:

    DirectoryIndex index.html

    change it to:

    DirectoryIndex index.php index.html

    The next time you access your web server with just a directory name, like "localhost" or "localhost/directory/", Apache will send whatever your index.php script outputs, or if index.php is not available, the contents of index.html.

Restart the Apache Web Server

Restart your Apache server. This is needed because Apache needs to read the new configuration directives for PHP that you have placed into the httpd.conf file. The command to do this for the Apache 2.x series can be found in the Start menu: Start -> Programs -> Apache HTTP Server -> Control Apache Server -> Restart.

Testing Your PHP Installation

Create a PHP file with the following line:

Save the file as "test.php" or any other name that you fancy, but with the ".php" extension, into your Apache htdocs directory. If you are using Notepad, remember to save as "test.php" with the quotes, or the software will add a ".txt" extension behind your back.

Open your browser and access the file by typing "localhost/test.php" into your browser's address bar. Do not open the file directly on the hard disk - you'll only see the words you typed in earlier. You need to use the above URL so that the browser will try to access your Apache web server, which in turn runs PHP to interpret your script.

If all goes well, you should see a pageful of information about your PHP setup. Congratulations - you have successfully installed PHP and configured Apache to work with it. You can upload this same file, test.php, to your web host and run it there to see how your web host has set up his PHP, so that you can mimic it on your own machine.

If for some reason it does not work, check to see whether your PHP setup or your Apache setup is causing the problem. To do this, open a Command Prompt window (found in the "Accessories" folder of your "Start" menu) and run php-cgi.exe on test.php with a command line like "c:\php\php-cgi test.php" (without the quotes).

If invoking PHP from the command line causes a large HTML file with all the PHP configuration information to be displayed, then your PHP set up is fine. The problem probably lies with your Apache configuration. Make sure that you have restarted the Apache server after making configuration changes. Verify that you have configured Apache correctly by looking over, again, the instructions on this page and the steps given in How to Install and Configure Apache 1.x for Windows (for Apache 1.x users) or How to Install and Configure Apache 2 on Windows (for Apache 2.x users).

Source : thesitewizard.com

Thursday, September 25, 2008

How to Choose a Domain Name
In the internet business, the domain name could be the beginning or the end of your business. Choosing your domain name wisely is essential to be ahead in the market. There are 2 types of domain names.
1. Keyword rich Product related domains For example, webdesignuk.com, smallbusinessreview.com etc. These domains clearly give you an idea of what the website is all about from the domain name itself. They are keyword rich and often rank well for the keywords in the domain if the site is optimized well. These websites usually fare well with most search engines.
2. Brand named Domain names Yahoo for instance or Google is a brand name. The Name Google itself will not tell you what it is. But who doesn’t know Google and yahoo. Brand name domains are good once you are into brand marketing. It’s often a bad idea if you are a start up Website Company to invest into a brand name domain. It usually costs a lot for brand marketing and its altogether a different ball game.
When choosing a domain name, make it as keyword rich as possible and also as short as possible. A domain name like makemoneyontheinternet.com is a great domain name but considering its length, it could just be bad. Limit your domain name length to as little as 10 to 12 characters. This would make your domain look good with the search engines. Also take enough time to choose your domain extension. If your domain is a .com it will have more chances to be found. .com domains are more preferred and will benefit you on the long run.

Article Source: http://EzineArticles.com/?expert=Rajiv_Sahadevan

Payment Gateway Reviews in India

Payment Gateway Reviews in India

There are now many payment gateway options are available in India. Some of these:
  • CCAvenue
  • Payseal from ICICI Bank
  • EBS from UTI Bank
  • HDFC Bank

According my opinion CCAvenue is good payment gateway in India. Hence their interface is very slow due to jsp page. But in this time they have lots of option for making payment.

CCAvenue Accepts following Credit cards:
VISA, AMERICAN EXPRESS, DINERS CLUB, CITIBANK E-CARDS and JCB CARDS

CCAvenue Accepts following Netbankings:
CCAvenue has been approved as a Super/Master Merchant by Citibank, ICICI Bank, American Express, UTI Bank, IDBI Bank, Centurion Bank, Punjab National Bank, Oriental Bank of Commerce, Kotak Mahindra Bank, The Federal Bank, Bank of Rajasthan, IndusInd Bank and HDFC Bank.

ICICI Bank (Payseal) also good but they have stopped mastercard option for number of customer without any intimation. Also they have no ETA to start again. They accept Master & Visa Cards Only.

EBS also just started the payment gateway. They accept Master & Visa Credit cards. But i have checked on some reference websites which they have given, thier processing is very slow, but they have assured me to resolve asap.

HDFC Bank also offering payment gateway, but its just biginning… Let’s see.

Source: ZNet India

Basic website design tips

Website building has become a common and essential knowledge to many people. Businesses, organisations and individuals have created websites either for commercial, or for personal recreational purposes.
When it comes to website building, one should pay extra attention to the fine details. This is to make sure that it performs optimally. Here are some important tips to observe to make sure your website serves its function properly.
1. Display simple and clear navigational menu
Provide a simple and easy to understand navigation menu so that even someone who is not internet savvy will know how to use it. It is best to stay away from complicated multi-tiered dropdown menus. If your visitors don’t know how to navigate the site confidently, they will eventually leave it.
2. Avoid using flash
Where appropriate, avoid using flash, especially for the first introduction page. People have to download the Flash player beforehand before they can view Flash movies. Because of this, the number of visitors will decrease considerably because not everyone will be willing to download the Flash player just to view your website.
3. Avoid using large graphic images Large graphic files take a long time to download and display.
Usually, visitors do not have the patience to wait for more than several seconds for the site to display itself. For this reason, keep the graphic files as small as possible. It is a good practice to optimise images before uploading them onto the server. I use GIMP, the free image editor for reduction of image file size.
4. Avoid using audio on your site
Audio is subjective and therefore not all will like the kind of music that is playing on a website. However, if you insist on adding audio, make sure the visitor can control the volume, stop or pause the music.
Well, these are some tips. They are by no means exhaustive, though. The key is to make the trip to your site as easy and as pleasant to the visitor as possible.

Article Source: http://EzineArticles.com/?expert=Shen_Gerald

Enable Thumbnails For PSD Files


Recently, I really got frustrated when I needed a quick preview of a PSD file, and the folder where it was saved was full of PSD files. I needed the file urgently. Then, I ended up opening each file manually to see what it was. Later, after I got through my work. I Googled some ways to overcome this problem in the future.

Adobe Bridge is good, and can be used to view what’s in the PSD file, but it eats half of my RAM, so I usually ignore it. After Googling for about an hour, I was finally able to have thumbnails instead of those blue feathers.

How To Enable Thumbnails For PSD Files

If you think this is going to be a long procedure, then you are wrong. It won’t even take 5 minutes to set up your PSD files to show the preview thumbnails. Simple follow the steps below.

First, make a quick backup of your system using System Restore. And backup your registry too!

1. Download psicon.dll from here (it’s a zip file)

2. Unzip it anywhere in your PC (You should have 3 files. psicon.dll, psicon.dll.reg and read me.txt)

3. Copy the psicon.dll to the following path:

C:\Program Files\Common Files\Adobe\Shell\

Remember, you might need to create the Shell folder, in Adobe directory.

4. After copying, execute the psicon.dll.reg file.

5. Click OK, for the info window that pops up to tell us that the registry key has been copied.

Done. See, no more than 5 minutes! ;)

Go to any folder containing PSD files, and choose Thumbnails from the View menu. You should now be able to view the thumbnails for PSD files, just as you see thumbnails of images.

I hope you enjoyed this trick and it has been helpful to you. I’d love to see you again on my blog.

Wednesday, September 24, 2008

HTML and JavaScript inside blogger posts using custom display boxes

It is very difficult for anyone using blogger blogs to show HTML codes and JavaScript inside the blog posts . You might have seen people showing the scripts in small display boxes of fixed length and width. Now after applying this blogger trick you will be able to show HTML and JavaScript inside blogger posts with custom display boxes .

Click on layout of the blog in which want show HTML or JAVA script and now select edit HTML
Before you apply any blogger trick ,remember to download and save your full template.
Now tick the expand widget templates and move onto the selection shown below

Otherwise you can press Cntrl+F and paste ]]> on appearing search box then enter
Paste the following code above the text appearing green and save the template


box
{
background:#efefef;
border:1px solid #A6B0BF;
font-size:120%;
line-height:100%;
overflow:auto;
padding:10px;
color:#000000 }
pre:hover {
border:1px solid #efefef;
}

code {
font-size:120%;
text-align:left;
margin:0;padding:0;
color: #000000;}
.clear { clear:both;
overflow:hidden;
}


The above code is for drawing a display box inside the blogger post to show HTML and java scripts.You can change the length ,width ,size and color of the box by editing the code .After adding this code you can call the display box anytime into your post by following next step.



Before you add "your HTML or JAVA script " make it post friendly by following this link
Inside the box provided paste the script and click make it friendly


Making the script postable is the only requirement if you plan to show the HTML or JAVA script alone without a box.