Go to content Go to navigation Go to search

Configuring PHP to work on Windows Server 2003

December 10th, 2008 by Gabriel

Simple steps to configure PHP with Windows :)

Suppose you have installed IIS and PHP say at C:\PHP on your Windows server then to configure PHP in IIS you can follow the below mentioned steps :-

Open up Internet Information Server(IIS) :-

http://winadmin.co.uk/Image1.PNG

Click on “Web Service Extensions”, on the left side you will find a green arrow near to “Add a new Web service extension…” click on it.

http://winadmin.co.uk/Image2.PNG

A pop up window will be appeared. Enter Extension name say .php and for the Required Files put “C:\PHP\php.exe”, enable the check box of “Set extension status to Allowed” at bottom :-

http://winadmin.co.uk/Image3.PNG

Now to add extension for the web site if its not there, right click on web site in question and select Properties >> Home Directory >> Configuration >> Add >> here you can add the extension shown as below :-

http://winadmin.co.uk/Image4.PNG

Basic SQL Statements

December 8th, 2008 by Gabriel

Basic SQL Statements :

SQL is used to query the database which are almost same for SQL Server, MS Access, Oracle and MySQL.
There are four types of basic queries :-

SELECT
INSERT
UPDATE
DELETE
ORDER BY

Different combination of parameters can be passed to a query.

1] SELECT :-

its the most common SQL statement using which data can be selected from database and the output is returned to user.The result is

stored in a result table, called the result-set.SQL is not case sensitive. SELECT is the same as select.
Here is a simple example -

select name, bdate from user;
this will return all names and bdates from the table user.

select * from user;
this will return all records of user table.

select * from user where name=’john’;
this will return all records in which name = john

select * from user where name=’john’ OR name=’paul’ OR bdate=01012007
this way you can add multiple filtering using “OR” , “AND” clause.

2] INSERT :-

it is used to take the data input from user and insert it into table of the database. Data can be taken from any form or it can be

directly inserted using query.It is used to insert a new row in a table.
Simple example-
Insert into Table1 (FirstName, LastName, Phone) Values (’Gabriel’, ‘R’, ‘1112222′);

3] UPDATE :-

Using Update, we edit / modify any exisiting table. Either all the rows can be updated, or a subset may be chosen using a condition.
Simple example -
Update Table1 Set name=@FirstName, LastName=@LastName, Phone=@Phone where id=@ID

WHERE clause us very important in Update query. If you don’t use WHERE then it will update all existing records in the table.

4] DELETE :-

It is used to delete rows in a table. It also uses WHERE claue. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted.
Here is an example of a Delete statement-

Delete From Table1 where ID=10

it will delete all records in which ID = 10

5] Order By Clauses :-

It is used to sort the output returned by a query. Using this clause, you can sort by any field in the table.
Example -
Select * from Table1 Order By name

This will list all returned records sorted by Name alphabetically.

‘ASC’ (ascending order) or ‘DESC’ (descending order) can be included in Orderby query to sort the output in ascending or descending order respectively.
Like -

Select * from Table1 Order By name DESC

How to start SQL server 2000 in Single User Mode

November 26th, 2008 by Gabriel

sql_logo How to start SQL server 2000 in Single User Mode

Single User mode allows only one single user to connect to the database.
Even if SQL server is in Single User Mode, you can connect the SQL Query Analyzer with the SA user.

Single user mode specifies that only one user at a time can access the database. Basically it is used for maintenance purposes.

If any other users are connected to the database and you  switch the database to single user mode then their connections to the database will be closed without any warning message.

Following are the steps to start SQL server in Single User mode -

On your server :

Start >> Run >> type in CMD and hit Ok >> it will open up Command Prompt >> here execute the following command

net stop MSSqlServer

>> it will stop the SQL service >> now to start SQL in Single User mode execute following command

sqlservr -m

####

How to Set a single database into Single User Mode :-

You can set a single database into single user mode using an alternative procedure but this process cannot be used to set the MASTER database into single user mode.

# Connect to SQL Server using SQL Query Analyzer with SA user

# Execute the following command -

alter database database-name set SINGLE_USER

where “database-name” is the actual name of the database.

This cannot be used to place the databases MASTER, MSDB or TEMPDB in single user mode.

# To set the database back into normal multi-user mode use, execute the following command -

alter database db-name set MULTI_USER

Database Connection String

November 24th, 2008 by Gabriel

A connection string is a string which contains information about a data source and its connectivity.
Connection string is always passed to a driver or provider which initiate the actual database connection.
It includes the attributes like name of the driver, server/host address, database name, security information like user name and password.
The format of a connection string is a semicolon-delimited list of key/value parameter pairs.

Following is a sample SQL database connection string :-

<add name=”SampleConnectionString” connectionString=”Data Source=AAAAAA;Initial Catalog=BBBBBB;User ID=CCCCCC;Password=DDDDDD” providerName=”System.Data.SqlClient” />

Where :
AAAAAA : Your server’s actual IP address.
BBBBBB : Your database’s actual Name.
CCCCCC : Your database’s actual Username.
DDDDDD : Your database’s actual Password.

MRTG installation and configuration

October 15th, 2008 by Gabriel

MRTG :-

MRTG (Multi Router Traffic Grapher) is a simple tool to administer the network traffic with IIS.
It queries SNMP counters and generate HTML pages with current network graphs for incoming and outgoing bytes. You can get detailed explanation of your traffic with MRTG.
MRTG is one of the intrusion detection tool it gives you the big picture of your network traffic in diffeent views like week, month, or year.

MRTG plays a very important role in case of hacking and attacking of server.  It helps to track down the exact cause and source of attack by allowing to monitor network traffic, number of packets, connections to server, protocol error messages, number of connected users, requests, CPU/RAM/disk usage, processes that are currently in execution state in memory etc.

MRTG installation on Windows server :-

Before we proceed to install MRTG we have to install SNMP with following steps

Go to Control Panel >> Add or Remove Programs >> Add/Remove Windows Components >> select Management and Monitoring Tools >> click on Details button >> enable the check box for “Simple Network Management Protocol” >> Click on OK then click on Next to proceed with installation.

Here you have installed SNMP for your server :)

MRTG is a Perl script hence you will need to download and install ActivePerl. You can refer following link to download and more information on Activeperl-
http://www.activestate.com/Products/ActivePerl/

Now downlaod the latest version of MRTG at - http://tobi.oetiker.ch/  OR  http://winadmin.co.uk/MRTG_files.zip

Extract the files into C:\Program Files\MRTG

Now we either create a web site for MRTG or create a virtual directory under any exisiting web site.
Set the MRTG site to not run scripts or executables and provide only Read access.
Move all the configuration files in to C:\Program Files\MRTG\Bin directory.
To test the configuration execute following command at mentioned location on command prompt -

C:\ProgramFiles\MRTG>perl mrtg mrtg.cfg

after SUCCESSFULL execution of above command you should now have some more files created in your MRTG web directory.

Now browse the web site/virtual directory you have created to get the MRTG output :)

CDOSYS Mail Script

October 15th, 2008 by Gabriel

Here is CDOSYS mail script :-

—————————

<%

‘CDOSYS Configuration
Set oMail = Server.CreateObject(”CDO.Message”)
Set iConf = Server.CreateObject(”CDO.Configuration”)
Set Flds = iConf.Fields

iConf.Fields.Item(”http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
iConf.Fields.Item(”http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “localhost”
‘Note use “localhost” If mail is routed from same server.
‘Use Server IP like “203.90.78.221″ if Domain has MX record having IP “203.90.78.221″ OR Mails are routed from that IP

iConf.Fields.Item(”http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout”) = 10
iConf.Fields.Item(”http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
iConf.Fields.Update

Set oMail.Configuration = iConf
oMail.To = “supp0rt_24×7@yahoo.com”
oMail.From = “supp0rt_24×7@yahoo.com”
oMail.Subject = “Script TEST.”

‘If message body is in HTML FORMAT
oMail.BodyPart.ContentTransferEncoding = “quoted-printable”
oMail.HTMLBody = HTML
oMail.Send
Set iConf = Nothing
Set Flds = Nothing

%>

<html>

Message Sent !!!

</html>

Microsoft SharePoint

October 14th, 2008 by Gabriel

Microsoft SharePoint is a browser based document-management platform.
It can be used by the web sites that access shared workspaces and documents, applications like wikis, blogs etc.
SharePoint interface is a web interface. Share point sites are mainly .Net sites with MS SQL as back end database.
It provide content management features, implement business processes, and supply access to information that is essential to organizational goals and processes.Support specific content publishing, content management, records management, or business intelligence needs.It provide centralized repository for shared documents, as well as browser-based management and administration of them.
Some of its good features includes workspaces and dashboards, navigation tools, lists, alerts (including e-mail alerts), shared calendar, contact lists and discussion boards etc.

The SharePoint family -

Windows SharePoint Services (WSS)
:-
Windows SharePoint Services 3.0 (WSS) is a free addon in Windows server which offers the infrastructure, supporting HTTP and HTTPS based editing of documents, as well as document organization in document libraries, version control capabilities, wikis, and blogs etc.
WSS 3.0 is built on top of ASP.NET 2.0.

Microsoft Search Server (MSS) :-
Microsoft Search Server (MSS) is a search platform supported by Microsoft. MSS shares its architectural underpinnings with the Windows Search platform for both the querying engine as well as the indexer. MOSS search provides the ability to search metadata attached to documents.Microsoft has made Microsoft Search Server available as Search Server 2008, released on March 2008. A free version, Search Server 2008 Express, is also available.

Microsoft SharePoint Designer (SPD) :-
The “What You See Is What You Get” editor MS SharePoint Designer focus on design of SharePoint sites and end-user workflows for WSS sites. Its nothing but the next-generation Microsoft replacement for Microsoft FrontPage :)
SPD requires that IIS has Frontpage extensions installed on the server.

IIS 6.0 Compression in Windows Server 2003

October 13th, 2008 by Gabriel

Benefits -

# Improve the performance with faster files

# Reduce Bandwidth Costs with Immediate effect

# Save server resources and in turn save money :)

Very basic steps that you can easily implement for IIS compression are as follows(provided you have some basic knowledge of IIS :)  )

[Note : Do not forget to  backup your metabase before you proceed ]

You will have to create a temporary folder to cache static file compression with any familiar name or even you can use default folder “%windir%\IIS Temporary Compressed Files”. Make sure IUSR have read/write permissions on this folder.

# Now open your IIS, at the left pane right click on Web Sites and select Properties

# click on Service tab - Enable Compress application files

# enable Compress static files

# change temporary directory to the folder you have created or default temp folder

# set max size of temp folder depending on the size of your hard drive

# Save and close

# edit the metabase at C:\Windows\system32\inetsrv\metabase.xml in Notepad

# locate for IIsCompressionScheme

# There should be two of them, one for deflate and one for gzip.  Basically they are two means of compression that IIS supports.

# add aspx,  asmx, php and any other extension that you need to the list extensions in HcScriptFileExtensions.

# HcDynamicCompressionLevel has a default value of 0, which can vary 0 -10, set it as per the need

# restart the World Wide Web Publishing Service

That’s it :)

Basic security precautions

October 12th, 2008 by Gabriel

Some basic security policies that a Web Administrator should have to consider are -

1. who/which user is allowed to use the system
2. when the user is allowed to use it
3. which user granted which level of access
4. procedures for granting access to the system
5. remote and local access methods
6. system monitoring
7. suspected security breaches

If you don’t have a clear picture of what is permitted, you can never be sure when a violation has occurred.

General security precautions to take -

1. Limit the number of login accounts available on the machine and delete inactive users.
2. The Crack programs help to detect poorly chosen passwords hence force the people to use strong             passwords who have login privileges.
3. Unused services should be turned off. For e.g. if FTP is no longer needed then it should be stopped.
4. Check system regularly for suspicious activity.
5. Make sure that permissions are set correctly on system files.

Custom Error page…

October 12th, 2008 by Gabriel

IIS allows you to display your own custom error pages instead of ugly default error pages. You will have to create an HTML or ASP page with the desired information you want to display.

Following are the steps -

1. Open Internet Information Server
2. Select your Web site in the tree view at left pane, right-click and choose Properties
3. Click on the Custom Errors tab.
4. Scroll down to the error you wish to change
5. select it, and click the Edit Properties button.
6. Enter the URL to your page that you have created
7. Click Ok at the bottom.

your customized error page will be displayed next time instead of old ugly and unfriendly default error page  :)

« Previous Entries