Monday, February 4, 2008

Web Application/ PHP-MySQL

Installing PHP on Windows

1. Extract the files from the .zip file into the directory where you want PHP to be installed, such as
c:\php
.

If you double-click the .zip file, it should open in the software on your computer that extracts files from .zip files, such as WinZip or PKZIP. Select the menu item for extract and select the directory into which the files are to be extracted. C:\php is a good choice for installation because many configuration files assume that’s where PHP is installed, so the default settings are more likely to be correct. It’s best not to install PHP in a directory with a space in the path, such as in Program Files/PHP. Doing so can cause problems.You now have a directory and several subdirectories that contain all the files from the zip file.

2. Copy the file required for MySQL to the PHP main directory.

The file is located in the ext subdirectory in the directory where PHP is installed. Copy one of the following files, depending on which version of MySQL you’re using:

ext\php_mysqli.dll (for MySQL 4.1 or later)

ext\php_mysql.dll (for MySQL 4.0 or earlier)


Copy the file into the main PHP directory, such as c:\php.

Another file, named libmysql.dll, is required for MySQL support. This file should already be located in the main PHP directory. If it isn’t, you need to find it and copy it there. If it’s not in your PHP directory, it’s usually installed with MySQL, so find it in the directory where MySQL was installed, perhaps in a bin subdirectory, such as c:\Program Files\MySQL\MySQL Server 5.0\bin. Occasionally PHP needs DLL files that it can’t find. When this happens, PHP displays an error message when you run a PHP program, saying that it can’t find a particular DLL. You can usually find the DLL in the ext subdirectory and copy it into the main PHP directory.


Configuring your Web server for PHP

Configuring IIS :

To configure IIS to work with PHP, follow these steps :

1. Enter the IIS Management Console.

You should be able to enter by choosing Start Programs Administrative Tools Internet Services Manager or

StartControl Panel Administrative Tools Internet Services Manager.

2. Right-click your Web site (such as Default Web Site).

3. Select Properties.

4. Click the Home Directory tab.

5. Click the Configuration button.

6. Click the App Mappings tab.

7. Click Add.

8. In the Executable box, type the path to the PHP interpreter.

For example, type c:\php\php-cgi.exe.

9. In the Extension box, type . php

This will be the extension associated with PHP scripts.

10. Select the Script Engine check box.

11. Click OK.

Repeat Steps 6–10 if you want any extensions in addition to .php to be processed by PHP, such as .phtml



Configuring PHP

PHP uses settings in a file named php.ini to control some of its behavior.

If the php.ini file isn’t installed during installation, you need to install it now. A configuration file with default settings, called php.ini-dist, is included in the PHP distribution. Copy this file into the appropriate location, such as the default locations just mentioned, changing its name to php.ini.



1. Open the php.ini file for editing.

2. Change the settings you want to change.

Steps 3, 4, and 5 mention some specific settings that should always be changed if you are using the specified environment.

3. Only if you are using PHP 5 or earlier, turn off magic quotes.

Look for the following line:

magic_quotes-gpc On

Change On to Off.

4. Only if you are using PHP 5/6 on Windows, activate mysqli or mysql

support.

Look for a list of extensions. Find the line for the mysqli extension, as

follows:

; extension=php_mysqli.dll

If you are using a version of PHP earlier than 5.0 or a MySQL version earlier

than 4.1, find the following line:

;extension=php_mysql.dll

Notice the semicolon (;) at the beginning of the lines. To activate the

extension, remove the semicolon. If the extension line isn’t in your

php.ini file, add it.

5. Only if you’re using PHP on Windows with the IIS Web server, turn

off force redirect. Find the line:

; cgi.force_redirect = 1

You need to remove the semicolon so that the setting is active, and also

change the 1 to 0. After the changes, the line looks as follows:

cgi.force_redirect = 0

6. Save the php.ini file.

7. Restart the Apache server so that the new settings go into effect.


Your required configuration is complete.

Now Enjoy using PHP/ MySQL in Windows, codes will be available soon.............











No comments: