Tuesday, July 21, 2009

Disable Skype from Using, Opening or Listening on Port 80 and 443

If you have running skype in your system and you now try to install web server or a program that need to use HTTP port 80 or HTTPS port 443, then there possibly an error message saying that the port 80 or 443 has been in used or occupied by another application. Though you don't have currently installed any web server like Apache or IIS (Microsoft Internet Information Service).

So you need to investigate which program is using/opening/listening on port 80 or 443. In the post, How to check or identify which process is listening to port 80 in windows it is clearly discussed who you can know which process listening on which port. So you can know the process name from that post.

Now our concern is about skype. Skype allows users to use port 80 and 443 as an alternatives for incoming connections. Skype uses port 80 and 443 to allow Skype behind firewall to connect to peer or accept incoming connection from peers.

Only one program can open/use/listen one port at a time. So if skype uses port 80 other program will not be able to use it. Skype uses port 80 and port 443 (for SSL HTTP connection) and thus prevent other applications which require such port from working properly. So to make important program to work like web server we need to disable skype to use port 80 and port 443. Also, leaving the port 80 and 443 opens and listening also has security risk where the port can be scanned by malicious virus or hacker to launch attack or infection.

If you want to use skype and also web sever then you must turn off and disable Skype usage of and listening on port 80 and port 443. following is the steps to do this.

1) Open the Skype window.

2) Click on Tools menu.

3) Select Options.

4) Click on Advanced tab.

5) Go to Connection sub-tab.

6) Untick or uncheck the check box for "Use port 80 and 443 as an alternatives for incoming connections option."

7) Click on Save button and then restart Skype to make the change effective.

Related Documents

How to include a php file inside smarty template

Well, many one of you heard about smarty template. In simple way we can say, Smarty template makes your PHP scripts independent of the layout.

While working with smarty template you may need to run a php code from the smarty template. Smarty always give the flexibility to do display code simply as a text as well as to execute php code.

Let's assume we have just installed smarty.
-You will see under Smarty>libs folder the main smarty class php file named Smarty.class.php and we need to make instance of Smarty class to use it.

-You can see sample code under Smarty>demo.

-And the template resides under Smarty>demo>templates.

Now we will execute php script named welcome.php from template named welcome.tpl

My welcome.php contains,
<?php
echo "Welcome to arjudba world.";
?>


and is saved under Smarty>demo.

My welcome.tpl contains,
{include_php file="welcome.php"}

and is saved under Smarty>demo>temaplates. Note that we can give full path here. Like {include file="include($_SERVER['DOCUMENT_ROOT'].'/includes/welcome.php');"}

Now from a php file we need to call the template file welcome.tpl and eventually template file will call welcome.php file. Let's name this php file as Smarty/display.php which contains,

<?php

require '../libs/Smarty.class.php';

$smarty = new Smarty;

$smarty->compile_check = true;
$smarty->debugging = true;
$smarty->display('welcome.tpl');

?>



Now in browser if you run for example on machine http://localhost/smarty/demo/display.php it will display,
Welcome to arjudba world.

And you are done. From welcome.tpl you ran welcome.php script.

I have shown a simple way above about how to run php script from template. There are other ways to do the job. Like in the template file writing as,

{php}
include("welcome.php");
{/php}


Related Documents
Datatypes in Php
Integer and floating point number in Php
Variables in PHP
Magic constants in php
Boolean datatype in Php

Monday, July 20, 2009

How to check or identify which process is listening to port 80 in windows

From yesterday, on my computer I could not start my apache service. From the XAMPP Control Panel Application whenever I start Apache it fails to start. I reinstalled apache several time but it could not help . In fact after installing Apache HTTPD web server or Microsoft IIS Internet Information Services web server, or any other application software or service and daemon that requires to open and listen to port 80 (HTTP) or port 443 (HTTPS SSL) it fails. So I consider myself to investigate about the program that is using port 80 or 443.

I am sure that a program is using port 80 or port 443 and restrict apache to use these port as I get following after installing Apache web server using XAMPP.

(OS 10052) Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down


So, I need to identify the program which is listening to port 80 and kill that process or at least restrict that process to listen to port 80.

To following steps will help you to find the culprit one.

1)Open command prompt. You can do it by clicking your start menu, then select Run, type cmd in the Run box and hit enter.

2)I expect you will see command prompt here unless you have viruses in your computer that restrict to show. In the command prompt type,

>netstat -o -n -a | findstr 0.0:80
in order to determine the process ID which is using port 80.

or type,
>netstat -o -n -a | findstr 0.0:443
in order to determine the process ID which is listening to port 443.

or type,
>netstat -aon
in order to list all connection that is listening, established, starting, closing and all other states. As netstat -aon will list all connections so from that you need to manually search for line 0.0.0.0:80 or 0.0.0.0:443 to determine the process ID.

3)Determine the process ID which is listening to port 80 or 443.
A typical output from the above commands are,
E:\Documents and Settings\Arju>netstat -o -n -a | findstr 0.0:80
TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4712

E:\Documents and Settings\Arju>netstat -o -n -a | findstr 0.0:443
TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       4712
UDP    0.0.0.0:443            *:*                                    316

E:\Documents and Settings\Arju>netstat -aon

Active Connections

Proto  Local Address          Foreign Address        State           PID
TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4712
TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1324
TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       4712
TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       1920
TCP    0.0.0.0:5101           0.0.0.0:0              LISTENING       7636
TCP    0.0.0.0:17536          0.0.0.0:0              LISTENING       316
TCP    10.65.49.113:1175      118.160.238.122:80     ESTABLISHED     316
TCP    10.65.49.113:1451      209.85.137.125:5222    ESTABLISHED     1588
TCP    10.65.49.113:1561      66.102.9.83:80         CLOSE_WAIT      3436
TCP    10.65.49.113:1623      96.17.159.66:80        CLOSE_WAIT      1964
TCP    10.65.49.113:2659      216.10.192.112:80      CLOSE_WAIT      5164
TCP    10.65.49.113:2782      216.10.192.112:80      CLOSE_WAIT      3692
TCP    10.65.49.113:3084      74.125.87.83:80        ESTABLISHED     2736
TCP    10.65.49.113:3179      74.125.87.191:80       ESTABLISHED     2736
TCP    10.65.49.113:3180      74.125.87.83:80        ESTABLISHED     2736
TCP    10.65.49.113:3185      74.125.87.101:443      ESTABLISHED     5164
TCP    10.65.49.113:3187      74.125.87.147:80       ESTABLISHED     5164
TCP    10.65.49.113:3850      68.180.217.28:5050     ESTABLISHED     7636
TCP    10.65.49.113:3881      68.142.233.181:80      ESTABLISHED     7636
TCP    10.65.49.113:4837      207.46.125.86:1863     ESTABLISHED     320
TCP    127.0.0.1:1247         0.0.0.0:0              LISTENING       3692
TCP    127.0.0.1:1557         0.0.0.0:0              LISTENING       6172
TCP    127.0.0.1:1557         127.0.0.1:1558         ESTABLISHED     6172
TCP    127.0.0.1:1558         127.0.0.1:1557         ESTABLISHED     7928
TCP    127.0.0.1:1672         0.0.0.0:0              LISTENING       1532
TCP    127.0.0.1:1727         127.0.0.1:1728         ESTABLISHED     7636
TCP    127.0.0.1:1728         127.0.0.1:1727         ESTABLISHED     7636
TCP    127.0.0.1:1990         127.0.0.1:1991         ESTABLISHED     5164
TCP    127.0.0.1:1991         127.0.0.1:1990         ESTABLISHED     5164
TCP    127.0.0.1:1993         127.0.0.1:1994         ESTABLISHED     5164
TCP    127.0.0.1:1994         127.0.0.1:1993         ESTABLISHED     5164
UDP    0.0.0.0:443            *:*                                    316
UDP    0.0.0.0:17536          *:*                                    316
UDP    10.65.49.113:123       *:*                                    1364
UDP    10.65.49.113:1900      *:*                                    1500
UDP    127.0.0.1:123          *:*                                    1364
UDP    127.0.0.1:1025         *:*                                    1924
UDP    127.0.0.1:1171         *:*                                    316
UDP    127.0.0.1:1716         *:*                                    320
UDP    127.0.0.1:1730         *:*                                    7636
UDP    127.0.0.1:1900         *:*                                    1500
UDP    127.0.0.1:2993         *:*                                    1588
UDP    127.0.0.1:9877         *:*                                    1924
UDP    127.0.0.1:9977         *:*                                    1924
UDP    127.0.0.1:62976        *:*                                    1924

From the above output we see process ID 4712 is the culprit one which is listening to port 80 and 443 and thus restrict web server to use them.

4)In this step find the process which has the Process ID 4712. You can simply follow http://arjudba.blogspot.com/2009/07/how-to-know-process-id-or-pid-on.html and bring task manager to display that process ID. From task manager Image Name determine the process name.

So now you can kill that process or still if you want to run that process first run you web server/apache and then run that program. In this way apache first will listen to port 80 and that program will not be able to use as it starts after web server.

Related Documents

How to know process ID or PID on windows

Process Identifier or Process ID or PID is the unique ID of a process running on the system. With PID we can uniquely identify a process and can know about their characteristics.

On unix based system like linux, solaris, HP-UX with "ps" command we can easily identify each type of process and their PID. We can also grep the output for filtering. But for Windows operating system such as Windows 95, Windows 98, Windows 2000, Windows XP, Windows Vista, Windows Server 2003, Windows Server 2008 and Windows 7 there is no such utility or command.

In windows through GUI we can still see the process ID or PID of a process. This is sometime very essential to track a culprit process. It can be seen from Task Manager. To get Task Manager right click on empty area in the task bar and then you can select Task Manger. You can also get Task Manager window by clicking CTRL+ALT+DEL.

After opening task manager you will see there is no process ID or PID there by default. But you can see Processes tab there. Whenever you click on processes tab, process information is shown. By default option is Image Name(Process Name), User Name(the user under whom process is running), CPU(percentage of CPU usage) and Mem Usage(Total how many KB is allocated to the process).

To get Process ID,
- Click Processes tab.
- Click on View menu, then click on Select Columns.
- In the "Select Columns" or "Select Process Page Columns" dialog, check the checkbox for PID (Process Identifier), and click OK.


You will see PID is shown and you can easily track each process identifier.

Related Documents