Difference between revisions of "Install IIS with PHP and MySQL"

From PGVWiki
Jump to navigation Jump to search
 
(No difference)

Latest revision as of 17:32, 16 May 2010

What is IIS?

IIS stands for Internet Information Services.

IIS is Microsoft's own web server which can be installed by everyone who has Microsoft Windows operating system and the Windows installation CD. IIS doesn't cost anything, just the time to install.

What is this article?

This article will walk you through with the help of many images how to install IIS, PHP and MySQL for PhpGedView. When finished, you will have your own web server which you can use privately at home as a test web server or even go online and let your family members connect to your PhpGedView installation.

The installation is quite easy. Don't be afraid to try it, no matter if you are a pro or a newbie.

This article is using only the basic installation to set up a working PhpGedView.

Security and firewall issues would be an other and even a longer article.

What do I need to start?


This article will use the following configuration :

  • Microsoft Windows XP Professional, with Service Pack 2
  • IIS 5.1
  • PHP and PHP pecl package 5.2.0
  • When you are downloading the packages, make sure that the PHP package and PHP pecl package have the same version and that they are not the installer, but the zip package.
  • MySQL Database 5.0.27 and MySQL Administrator 1.2.4rc
  • PhpGedView 4.0.2

Attention! If you are using different Windows Operating systems, or different program versions of the downloaded programs, there might be some installation and configuration differences.

Install IIS

The first thing is to install IIS.

Place your Microsoft Windows installation CD into your CD drive.
Go to "Control Panel" -> "Add or Remove Programs" -> "Add/Remove Windows Components"
In the "Windows Components Wizard" window highlight "Internet Information Services" and click on "Details"
In the "Internet Information Services" window mark the box for "World Wide Web Services" and click on "OK".
These steps you can see on figure 1

Install IIS, figure 1


In the "Windows Components Wizard" click "Next".
Click "Finish" after Windows has installed IIS.

Open your Internet Explorer browser and type in the address bar http://localhost
Congratulations! You have your own web server.
Figure 2 shows you how it should look in Windows XP

Install IIS, figure 2


For now, we will wait to configure IIS.

Install PHP

Why install the PHP package?
The PHP package makes it possible for any web server to be able to run php script web pages, like PhpGedView. Without the php package you would see only the text of the script and not the page.
When you are downloading the packages, make sure that the PHP package and PHP pecl package have the same version and that they are not the installer, but the zip package.

  • Make a new folder and name it "php" on your root drive, like C:\
  • Extract the downloaded php zip file into this folder
  • Extract the downloaded php pecl zip file into the ":\php\ext" folder

See figure 3

Install PHP, figure 3


Find "php.ini-recommended" file in the ":\php" folder. Copy the file to ":\WINDOWS" folder and rename it to "php.ini".
This is the file that controls how php should work.

Configure PHP

Open the file ":\WINDOWS\php.ini" in any text editor.
Find:

max_execution_time = 30

and change it to:

max_execution_time = 60

This tells php how many seconds a script should run before timeout.
Find:

doc_root =

and change it to:

doc_root = "C:\Inetpub\wwwroot"

or where your web pages will be
Find:

extension_dir =

and change it to:

extension_dir = "C:\php\ext"

Enable these extensions by removing the ";" in front of the line. If you can not find some of them, write them here in this section.

extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysqli.dll

These extensions are needed to run PhpGedView.

You can also change the session folders path insted of using the Windows default temporary folder.
You can do this by adding or editing the "session.save_path" variable to this:

session.save_path = "C:\php\session"

Make sure that this folder exists, if not, make one.

For testing later on, make a php file to test the php installation.
Open a text editor, like Notepad and write these lines:

<?php
phpinfo();
?>

Save this as "phpinfo.php" in your web folder "C:\Inetpub\wwwroot" (if this is the default folder for your web pages.)

Configure IIS

Windows XP has IIS 5.1. This example shows you how to configure this version.
Go to "Control Panel" -> "Administrative Tools" -> "Computer Management"
Browse to "Services and Applications" -> "Internet Information Services" -> "Web Sites" -> "Default Web Site"
Right click on "Default Web Site".
Click on "Properties" -> "ISAPI Filters" tab -> "Add".
"Filter Properties" window will be opened. In the "Filter name:" box, write

.php

In the "Executable:" box, browse to your php installation folder and choose "php5isapi.dll".
See figure 4

Configure IIS, figure 4


Click "OK" to close the window and click "Apply".

Go to "Documents" tab -> "Add". In the "Default Document Name:" box, write:

index.php

See figure 5

Configure IIS, figure 5


Click on "OK" to close the window and click "Apply".

We have now added “index.php” to a list of files that IIS will search for in a web folder. The first file IIS finds in this list in a web folder will be loaded. You can mark index.php and with the arrows you can move it up or down to choose the files priority. You can change the priority for every folder separately in the same way.
Go to "Home Directory" tab -> "Configuration..." -> "Add". In the "Executable:" box, browse to the "php5isapi.dll" file and in the "Extension:" box write

.php

See figure 6

Configure IIS, figure 6


Click "OK" -> "Apply” -> and "OK" in the "Default Web Site Properties" window to close it.
In the "Computer Management" window browse to "Services and Applications" -> "Services".
In the right window, search for "IIS Admin" and click on "Restart" to apply all changes we made.
See figure 7

Configure IIS, figure 7


Open your web browser and type: http://127.0.0.1/phpinfo.php
See figure 8

Configure IIS, figure 8


Congratulations! You have a web server with PHP installed!


IIS 6 is installed and configured in a similar way as IIS 5 so far. IIS 6 has one more setting left before you can restart the web service to apply all your changes and to browse to phpinfo.php.
In the "Computer Management" window browse to "Services and Applications" -> "Internet Information Services (IIS) Manager" -> "Web Service Extensions"
Click "Add a new Web service extension..."
In the "Extension name:" box, write example: "PHP"
For "Required files" click "Add" and browse to your":\php\php5isapi.dll"
Mark the box "Set extension status to Allowed"
See figure 9

Configure IIS 6, figure 9

Restart IIS and now browse to http://127.0.0.1/phpinfo.php

Install and configure MySQL

Why install MySQL?
MySQL is probably the best free database in the market that PhpGedView supports. Most likely, PhpGedView will always support MySQL.

Start the MySQL installation program. These are the steps window by window :
Typical -> Next
See Figure 10

Install MySQL, figure 10

Install
You can choose to "Skip Sign-Up", for now -> Next
See Figure 11

Install MySQL, figure 11

Mark "Configure the MySQL Server now" -> Finish
See Figure 12

Install MySQL, figure 12


The steps to configure MySQL :

Next
Mark "Detailed Configuration" -> Next
See Figure 13

Comfigure MySQL, figure 13

Mark "Developers Machine", for low memory usage -> Next
See Figure 14

Comfigure MySQL, figure 14

Mark "Transactional Database Only" -> Next
See Figure 15

Comfigure MySQL, figure 15

Make sure your installation path is ok -> Next
Mark "Decision Support (DSS)/OLAP” -> Next
See Figure 16

Comfigure MySQL, figure 16

Mark "Enable TCP/IP Networking" and "Enable Strict Mode", set "Port Number:" to 3306 -> Next
See Figure 17

Comfigure MySQL, figure 17

Mark "Best Support For Multilingualism", support for UTF8 character set -> Next
See Figure 18

Comfigure MySQL, figure 18

Mark "Install As Windows Service" and "Launch the MySQL Server automatically" and "Include Bin Directory in Windows PATH" -> Next
See Figure 19

Configure MySQL, figure 19

Mark "Modify Security Settings", type your password -> Next
See Figure 20

Configure MySQL, figure 20

Execute
Finish

You may need to restart Windows now.
Open your browser and browse to http://127.0.0.1/phpinfo.php
Now you can also find the "mysqli" extension on the PHP information page.
See Figure 21

Configure MySQL, figure 21


Install MySQL Administrator.
After installation start the program and fill in the settings and click "OK".
See figure 22

MySQL Administrator, figure 22


Here you can manage and configure MySQL easy. Usually the only two things you would need to configure are "User Administration" and "Catalogs"
Click on "Catalogs" and right click in the "Schemata" window (not the empty box), "Create New Schema". Type in the "Schema name:" like "phpgedview".
See figure 23

MySQL Administrator, figure 23


Now you have a database for PhpGedView with the name "phpgedview".
When you start PhpGedView for the first time, PhpGedView will fill this database out for you. Do not change anything manually in the database!
You might also need to add a new MySQL User to use it in PhpGedView instead of the main administrator "root", for security reasons, especially if you go online.
To add a new user in MySQL, just click on the "User Administration" and "New User". Fill in the user name and the password you want to use for PhpGedView.
You also have to assign this MySQL user some privileges to your PhpGedView database. The privileges have to be: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER.
See figure 24

MySQL Administrator, figure 24

Install PhpGedView

Make a new folder in ":\Inetpub\wwwroot" and name it "phpgedview".
Extract the downloaded PhpGedView zip file into the "phpgedview" folder.
Go to "Tools" -> "Folder Options" -> "View" tab and unmark "Use simple file sharing" -> "Apply" and "OK"
See figure 25

Install PhpGedView, figure 25


In Windows XP, this is how you have to enable to have the right to give security permissions to files and folders.

Right click on "config.php" and "Properties" -> "Security" tab.
Highlight "Internet Guest Account". "IUSR_xxx" is the IIS user for which we have to give write permission. The "_xxx" in "IUSR_xxx" is your computer name.
See figure 26

Install PhpGedView, figure 26


Click "Apply" and "OK".
If you cannot find "IUSR_xxx" in the list, just hit the "Add" -> "Advanced" -> "Find Now" to add the IIS user to the list.
You also have to add write permission to the "index" and "media" folder.
When you are finished with the PhpGedView configuration, don't forget to remove the write permission of the "config.php" file for security reasons.

Open your browser and type: http://127.0.0.1/phpgedview/
See figure 27

Install PhpGedView, figure 27


Congratulations! You have now your own IIS web server with PHP, MySQL and PhpGedView.
In this article we are using the "php_mysqli.dll" extension for MySQL 4.1+ and PHP 5 so Figure 27 shows you the basics of starting configuration.

Configuring

1. Choose "MySQL 4.1+ and PHP 5" as the database type
2. Set the database host as localhost, or you can also use the IP address 127.0.0.1

For browsing, don't use http://localhost, that will give you login problems. Use instead http://127.0.0.1 or your computers IP address for your computer - to get this, open a command prompt (Start/Run/cmd) and type:

ipconfig 

The "IP Address" is your computers address.

Good luck.