Installation of Php-Mysql-Joomla On Windows Server 2008 32 Bit OS

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 18

We start by installing the Web Server role on Windows Server 2008 on 32 bit OS.

1. Go to Server Manager
2. Go to Roles click on add roles

3. Select server roles

4. Select role service as CGI


5. Select Management tools

6. Click on install
7. After completion of installation click on close button
8. In Server Manager Click on Web Server (IIS) under Roles and configure IE ESC

9. Temporarily disable Administrator security. It helps while configuring the Joomla. After installation of
joomla enable this security.
Install and Configure MySQL for PHP Applications on IIS 7

Introduction

While Microsoft® SQL Server® 2008 is the recommended database to use when hosting PHP applications on an
Internet Information Services 7 (IIS 7) Web server, you can also use MySQL as the database. Currently, many
popular PHP applications use MySQL Server for data storage. Using MySQL requires hosting providers to include
MySQL database support with the hosting packages.

MySQL cannot currently be installed with the Microsoft® Web Platform Installer (Web PI). This article provides
guidance for installing MySQL manually.

Install MySQL Server on Windows Server 2008 or Windows Server


2008 R2

It is recommended that you install MySQL on a dedicated server rather than installing MySQL on the same
server that is running IIS 7. The separation of database server and Web server makes overall installation more
secure and manageable and avoids resource contentions between the database and Web server processes.

1. Download MySQL Community Server.

a. We recommend downloading Windows® Installer.

2. Start Windows Installer, or extract all the files from the archive, and then start Setup.exe.

3. You can use a Typical Setup or customize the installation to suit your needs.

4. Once the installation wizard is completed, it is recommended that you leave the Configure the MySQL
Server now check box selected.

Configure a MySQL Instance

1. Run the MySQL Server Instance Configuration Wizard, and then choose the configurations options that
most closely match your environment.
For more information, see the Server Instance Configuration Wizard.
Best practice recommendations are as follows:

a. Click Next in the Instance Configuration Wizard.

b. Select Detailed Configuration, and then click Next.


c. Select a server type that best suits your environment. It is recommended to set up a separate MySQL
server; when prompted to select a server type, select Dedicated MySQL Server Machine, and then click
Next.

d. Select a database option, and then click Next.

Select either the Multifunctional Database or Transactional Database Only options if you are using the
InnoDB storage engine or the high-speed MyISAM storage engine (for example, if the Web applications on your
server require multi-statement transactions, advanced isolation levels and row-level locking, foreign key
constraints, or atomic, consistent, isolated, and durable [ACID] features). These options provides fully ACID
transactional capabilities, but at the cost of more aggressive usage of disk space and memory.

Otherwise, use the Non-Transactional Database Only option, which is optimized for high-performance
SELECT operations. It has low overhead, in terms of memory usage and disk utilization, but at the cost of not
supporting transactions.

e. Choose the option that sets the number of concurrent connections you need.

Note: Connections require memory; if the number you choose is too big, your server may not have enough
memory.

f. You may adjust networking settings to suit your environment or accept defaults, and then click Next.

g. Select the default character set that best suits you, and then click Next.

h. We recommend enabling both Windows options here. Select both check boxes, and then click Next.

i. Type the password you want to use for the root account, and then click Next.

j. Click Execute to apply your settings.

k. Click Finish to close the wizard.

2. For PHP to work with MySQL, it is necessary to perform the following modifications to the Php.ini file:

a. Confirm that the extension_dir points to the folder where all PHP loadable extensions are located,
frequently in the Ext folder (for example, extension_dir=”.\ext”).

b. Enable dynamic extension for MySQL by uncommenting the corresponding line for the MySQL extension:
extension=php_mysql.dll

c. Save and close the Php.ini file.

Secure MySQL
1. Remove the anonymous database account (if it exists). Open the MySQL command prompt by clicking Start
-> All Programs -> MySQL -> MySQL Server 5.1 -> MySQL Command Line Client:

2. Enter the password for the root account.

3. Once logged on to MySQL, use the following sequence of commands:

mysql> use mysql;


Database changed
mysql> DELETE FROM user WHERE user = '';
Query OK, 2 rows affected (0.03 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)

4. Next, restrict the root account to log on only from localhost. Open a MySQL command prompt, and use the
following sequence of commands:

mysql> use mysql;


Database changed
mysql> DELETE FROM user WHERE user = 'root' AND host = '%';
Query OK, 2 rows affected (0.03 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)

5. Change the name of the root user with the following sequence of commands from the command prompt:

mysql> USE mysql;


Database changed
mysql> UPDATE user SET user='johndoe' WHERE user='root';
Query OK, 1 row affected (0.19 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.23 sec)
Provision the User and Database

1. To provision a new user, type the following command from the MySQL command prompt:

mysql>CREATE USER ‘taskrunner’ IDENTIFIED BY ‘taskrunner’;


Query OK, 0 rows affected (0.00 sec)

2. The newly created user does not have any privileges on the MySQL server by default. To create a new
database, type the following command:

mysql>CREATE DATABASE IF NOT EXISTS taskrunner;


Query OK, 1 row affected (0.00 sec)

3. To grant access to this database for a particular user, type the following command:

mysql> GRANT ALTER,


-> ALTER ROUTINE,
-> CREATE,
-> CREATE ROUTINE,
-> CREATE TEMPORARY TABLES,
-> CREATE VIEW,
-> DELETE,
-> DROP,
-> EXECUTE,
-> INDEX,
-> INSERT,
-> LOCK TABLES,
-> SELECT,
-> UPDATE,
-> SHOW VIEW
ON taskrunner.* TO ' taskrunner';
Configure PHP to Access MySQL

1. Open the c:\php\php.ini file with your favorite text editor.

2. Uncomment the following lines by removing the semicolon:

extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll

3. Restart the IIS service by clicking on Start, selecting the Search Field, typing iisreset, and then pressing
ENTER.

4. If all went well, you should see the mysqli section on the PHP information page created
earlier (http://localhost/phpinfo.php).

Figure 1: The mysqli section on the PHP information page

Best Practices for MySQL

• Enable TCP/IP Networking


This is the default. Keep the TCP port that MySQL uses to listen at 3306. If the database will be running on
a separate system from the Web server, select the Add firewall exception for this port check box.
• Include Bin Directory in Windows PATH
This makes the MySQL utilities available from the command prompt or from Windows PowerShell™.
• Create an Anonymous Account
The default is to keep this disabled. Adding anonymous user support may create a security risk for the
database; additionally, enabling anonymous users causes the GRANT statements used to set up database
to be unreliable.

Install PHPMyAdmin on IIS7 and Server 2008


After installing our copy of MySQL on IIS7 and Server 2008, you might be wondering what to do next.

Well if you don’t feel like learning the command line sequences for MySQL you might be interested in using a
web based GUI based tool which will make managing the databases a lot easier.

This tool is called PHPMyAdmin and can be found at www.phpmyadmin.net.

What will you be able to do with PHPMyAdmin in the database?

Here is a list of some of the features:

• browse and drop databases, tables, views, fields and indexes


• create, copy, drop, rename and alter databases, tables, fields and indexes
• maintenance server, databases and tables, with proposals on server configuration
• execute, edit and bookmark any SQL-statement, even batch-queries
• load text files into tables
• administer multiple servers
• create and read dumps of tables
• search globally in a database or a subset of it

And that is just the short list of features of this very powerful application. It recently was named Best of Open
Source Platforms and Middleware by Infoworld.

Note: PHPMyAdmin requires both PHP and MySql to be installed on the server. If you need to please refer
back to my articles on installing them:

• Installing PHP
• Installing MySql

Download and Install PHPMyAdmin

Ok so now that we know why we should install it, let’s get to the actual installation part.

But before we begin, let’s go download the software at: www.phpmyadmin.net/home_page/downloads.php.

The current version as I write this article is 2.11.9, so I am going to go ahead and download that to get started.
Which version you use will depend on your environment; I am going to use the english.zip for this demo. Let’s
get started!

1. Extract the files from the archive to a site that is available on the web server (remember the application is
web based).

For this demo I am going to use C:\inetpub\wwwroot\phpmyadmin

2. Now start IIS Manager and expand the default website; right click on phpmyadmin and left click on
Convert to Application.
3. You can leave the default settings in place for the Add Application window and click OK.

4. Create a folder to save your PHP sessions; for our example I am going to use C:\temp\phpsessions and give
full rights to the following users:

IUSR
IIS_IUSRS
Network Service

5. Now go into your php directory and find php.ini — we have to make a few changes:

Find session.save_path and set it to the same as you used in step 4 which in our case is C:\temp\phpsessions
and save the file.

6. Please note that this application requires the following extensions for PHP:

MySQL
GD
MBSTRING

If you do not have these on your server already, please install them. If you are using my article to install PHP
then in step 6 just add the above extensions to your installation, or if you already installed it rerun the installer
msi file and modify your installation to include these extensions.

To check if they are installed do a search for extension=php_mysql in the php.ini and you should see it
uncommented.

Do the same for the other extensions:

extension=php_gd2.dll
extension=php_mbstring.dll

7. Go into IIS Manager, go to the default site (that is if you have been following my demo, if you have been
modifying your site location or path then use that) and click on Default Document.

8. In the right pane click Add…


9. In the dialog box type index.php and click Ok.

10. Go to the directory that you unzipped PHPMyAdmin to and look for a file named config.sample.inc.php
and open it in Wordpad. (You can use notepad but it tends to jumble everything up)

11. Now find the line $cfg[‘blowfish_secret’] = ‘’; you have to fill in this line with anything that you want but
it needs to be a value.

Only up to 46 characters and it can be alphanumeric. In this case I am going to use trainsignal1111TST

12. Go down to you see the section User for advanced features and uncomment (Remove the // from the front
of the line) the two lines under that and change the pmapass to a different password, for this demo I am going
to use trainsignal.

13. next, go down to the next section Advanced phpMyadmin features and uncomment all the lines under it
(remove the // from the front of the line).

14. Now save this file as config.inc.php

15. Point your browser to http://localhost/phpmyadmin/ (if you have been following this example; if you have
used a different site/directory then point to that) and you should see a login page.

Type in the userid and password for your local MySql server, then click Go.

16. Now you are in and able to manage your MySql instance!

As a quick test let’s create a database by scrolling to the Database link and clicking on it

17. Type in the name of your new database, for this example I am going to use Trainsignaltraining and then
click Create.

18. You will now see a page that confirms that database Trainsignaltraining has been created.
That’s all there is to it, now you can quickly and easily manage you MySql databases on IIS7 through
PHPMyAdmin.

Install Joomla! On IIS

This article describes how to install and configure Joomla for use with the FastCGI extension on Internet
Information Services 7 (IIS 7) on Windows® Web Server 2008. The instructions assume that you have set up and
configured the FastCGI extension and the PHP libraries. The instructions have been tested and found to work
with the following software versions:

• PHP 5.2.9
• MySQL 5.1.34
• Joomla 1.5.14

Prerequisites
From the base default configuration file provided by PHP, modify the following lines in your Php.ini
configuration:

• Define extension_dir as c:\php\ext (for example, the location of your php extensions directory).
• Uncomment extension=php_mysql.dll in the extensions list to enable MySQL support.

In order for Joomla to work correctly with IIS 7, it is necessary to install an update for IIS FastCGI module for IIS
7.

Download and Unpack the Application

First, download the latest stable release of Joomla. For this article, Joomla version 1.5.14 was used (future
versions are likely to be similar to install). Uncompress the Joomla files and copy them to
C:\Inetpub\wwwroot\joomla (or another directory of your choosing).

Before running the Joomla installer, create the configuration file Configuration.php, which Joomla uses to
store key configuration settings. Assign write permissions to it with the command (from the installation
directory):

C:\inetpub\wwwroot\joomla>icacls configuration.php /grant BUILTIN\IIS_IUSRS:W

The installer will modify the Configuration.php file with information provided during the installation process.

Joomla uses the Administrator\Cache folder Tmp and therefore needs to be able to write and modify files in this
folder. Grant “modify” permissions to the folder:
C:\inetpub\wwwroot\Joomla>icacls administrator\cache /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)

Joomla uses the temporary folder Tmp to store temporary files and therefore needs to be able to write and
modify files in this folder. Grant “modify” permissions to the folder:

C:\inetpub\wwwroot\Joomla>icacls tmp /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)


Set Up the Database

Before starting the installation procedure for Joomla, you must create a database on your server. Also create a
user and grant this user “db ownership” permission to the database. This article uses the following database
information:

• Database name: joomla


• Database user: joomla
• Account password: joomla

Run the Installation Script


1. Start the configuration procedure in a Web browser. Go to http://localhost/joomla/. (If the Index.php file is
not in the browser default document, then add it.)

2. Select the language, and then click Next.

Figure 1: Choose Language page

3. Verify that all pre-installation checks are successful, and then click Next.
Figure 2: Pre-installation Check page

4. Review the GNU General Public License, and then click Next.

Figure 3: License page

5. On this page enter the following information, and then click Next.

a. Host Name: localhost


b. Username: joomla
c. Password: joomla
d. Database: joomla

Figure 4: Database Configuration page

6. On the FTP Configuration page, select the No option button (not to enable FTP file system layer), and then
click Next.

Figure 5: FTP Configuration page

7. Specify the site name and the administrator password. Click Next to complete the installation.
Note: You may scroll down and install sample data if you prefer.

Figure 6: Main Configuration page

8. The Finish page appears, and you are instructed to delete the C:\inetpub\wwwroot\joomla\installation
directory.

Figure 7: Finish page

9. You can now go to the Joomla site.


Figure 8: Joomla site

Enable Search Engine Friendly URLs

By default, Joomla uses query string parameters for all the URLs it generates for your Web site. You change this
by by enabling search engine friendly URLs, a feature which relies on the URL rewriting functionality.

IIS 6.0 does not include URL rewriting capabilities; you can use a third-party URL rewriting product such as
ISAPI_Rewrite or Ionics ISAPI Rewrite Filter.

IIS 7 includes URL rewriting support, which can be enabled by installing Microsoft URL Rewrite Module for IIS 7.

1. Download and install the Microsoft URL Rewrite Module.

2. If it does not already exist; create and open a Web.config file located in the C:\inetpub\wwwroot\joomla
directory.

3. Paste the following XML code into this file.

<?xml version="1.0" encoding="UTF-8"?>


<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Security Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)"
ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})"
ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})"
ignoreCase="false" />
</conditions>
<action type="CustomResponse" url="index.php" statusCode="403"
statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="SEO Rule">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern=""
ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern=""
ignoreCase="false" />
<add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
<add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

4. Save the web.config file.

5. Open a Web browser, and log on to the Joomla administrator console at


http://localhost/joomla/administrator/.

6. Click on Site --> Global Configuration menu to configure SEO Settings:

1. Search Engine Friendly URLs - Yes

2. Add suffix to URLs - No


Figure 9: Global Configuration page

3. Click Apply to save the configuration.

4. Restart Windows® Internet Explorer®.

5. Go to http://localhost/joomla/. All links in Joomla pages now have URLs without query string parameters. If
you click on any of these links, the server returns a correct response:

You might also like