Tuesday, July 26, 2011

Cannot start mysql service on windows server 2003

Once you removed and reinstall Mysql on windows server 2003, you may facing to an error likes: "Can not start services".

To fix it, you have to remove all of the relating to mysql data at:
C:\Documents and Settings\All Users\Application Data\MySQL
and
C:\Program Files\MySQL (path to mysql implementation, this is an example of mine)
Okey, next step you may reinstall and restart mysql service as normal, it works for me.

Lai

Monday, July 25, 2011

The difference between CGI, ISAPI, and FastCGI

CGI

CGI is a protocol that allows information servers to interface with external applications. Because HTTP is stateless, any requests that are made over HTTP create a new instance of the external application in a new operating system process.

Within the new process, the stdin handle is remapped so that it receives request data from the client, the stdout handle is remapped so that it writes response data to the client, and the command line and operating system environment variables are set to provide other server and request information to the CGI process.

The disadvantage with CGI on IIS is the relatively expensive process creation on Windows operating systems. Every HTTP request creates a new process, performs the work inside the CGI application, and shuts down the process. On operating systems with light-weight process creation, performance is bound by the work that is completed inside the CGI application. On operating systems where process creation is expensive, such as Windows, performance of the CGI application is bound by spinning up the new process. This is the reason why CGI has performed well on a Unix-based platform, but has not been recommended for IIS.

ISAPI

Despite the disadvantage of CGI on Windows, IIS is capable of keeping up with, and often surpassing, the performance of other Web servers. The reason for this is Internet Server Application Programming Interface (ISAPI). Unlike CGI, ISAPI is completely internal to the Web server process. When a new request is made for an ISAPI application, a new process is not created. Instead, the Web server calls an entry point in a DLL that is loaded into the Web server process. If the ISAPI application is written with an understanding of how the operating system threading model works, the performance is extremely fast.

For many years, PHP has run on IIS through both ISAPI and CGI implementations. However, both implementations have disadvantages when running on IIS. As with all CGI applications, the CGI implementation of PHP has a disadvantage due to the performance characteristics of process creation on the Windows OS. The ISAPI implementation has a disadvantage due to threading issues.

When PHP runs as an ISAPI, it runs inside the Web server process in a highly multi-threaded environment. While the PHP implementation is thread-safe, many popular extensions to PHP are not thread-safe. If you use a non-thread-safe extension to PHP with ISAPI, the server can become unstable. Hence, many applications cannot run in the ISAPI PHP implementation, while other applications can run well in this environment.

FastCGI

FastCGI offers a solution that delivers both performance and stability. FastCGI allows the host CGI process to remain alive after one request finishes so that the process can be reused for another request. Since the process can be reused many times, the cost of process creation on the Windows OS is no longer an issue.

The technical difference between normal CGI and FastCGI is that FastCGI has a layer in the process that maps the FastCGI protocol into the stdin, stdout and other resources that CGI uses. Many third-party libraries can be linked into existing CGI source code with minor modifications to make them work with FastCGI.

FastCGI on IIS runs on top of ISAPI and can be broken down into the following parts: applications, the application manager, and the FastCGI protocol support code.

Because Web servers handle multiple, concurrent requests, a pool of processes must be available and ready to handle incoming requests. In the FastCGI handler, this pool of processes is called an application (to avoid confusion with IIS applications, this article uses the term "process pool"). There are a number of properties of a process pool that you can manage. For example, you can specify the number of processes in the pool, or the number of requests that a process is allowed to accept before it is shut down and recycled.

The FastCGI handler supports multiple process pools so that you can run more than one kind of FastCGI on a single server. For example, you can configure your server to support both PHP and Ruby on Rails. If you have multiple sites on your server and do not want requests for those sites to share the same processes, you can have the site processes run as different users. The part of the server that handles multiple process pools is called the application manager.

Setup PHP - Mysql - Phpmyadmin on Windows server 2003: using FastCgi

Prepairing:
* FastCgi: (The difference between CGI, ISAPI, and FastCGI)
- I used ISAPI modules for the PHP implementation on my windows server 2003 therebefore, it's performance however I have ever seen some errors with this module on my php applications. Until, I moved to FastCgi. FastCGI offers a solution that delivers both performance and stability.
- On windows server 2003, fastcgi is not installed by default to IIS6 and 5.1, you will need to setup addition this protocol on your windows server.
- Download here: http://www.iis.net/download/fastcgi

* PHP:
- Download lastest PHP intaller on http://windows.php.net/download/ . I recommend to download for version 5.3.6 (.msi) or later (because this is fixed for sendmail use external SMTP, mean of you can send email work fine use other Smtp likes: smtp.gmail.com:465 , cause of openssl is enabled).
- Non thread safe & thread safe. PHP was released two version, and you can choose the version that depend your purposes. As you know, many popular extensions to PHP are not thread-safe, if the PHP implementation is thread-safe then the server can become unstable. Hence, many applications cannot run(ex: error of import database use phpmyadmin). Thus, I recommend to Non thread safe.
- In this post, I will use the PHP installer(.msi) for easy. No recommend for advanced users.

*MySql:
- Download Mysql msi installer for windows here: http://www.mysql.com/downloads/mysql/

*Phpmyadmin:
- Download here: http://www.phpmyadmin.net/home_page/downloads.php
- Classical UI: version 3.3.10.2 to order
- New UI: 3.4 to later.

Installation
Step by step....
Step 1: Install FastCgi
Step 2: Install PHP use Msi installer with FastCgi option.
Step 3: Install Mysql and remember your root password
Step 4: Copy phpmyadmin to your webroot(ex: C:\inetpub\wwwroot). Modify config.inc.php file with your mysql root user/password.
Step 5: Restart IIS to apply the changes to IIS

Done.

Wednesday, December 22, 2010

How do I show hidden files with FTP Clients?

Configuring your FTP client to show hidden files is a process that differs significantly from each FTP client. Instructions for doing so using many popular FTP clients can be found below:

In Dreamweaver
Dreamweaver won't display hidden files in Site View. You can either use another FTP program or you can use your filemanager.

In Filemanager
Step 1: Go to www.yoursite.com/fileman/fileman.cgi?
Step 2: Select the 'web' folder
Step 3: Select Preferences from the tools menu.
Step 4: Tick the 'File Display' -' Do you want to show hidden files?' checkbox (NB: The directory will refresh showing the hidden files.)
Step 5: You can then delete / copy / move the file using the Commands menu.

In CuteFTP
How To do:

- site manager
- right click the site
- properties (option)
- actions (tab)
- filter ... (button)
- tick enable server site filtering (checkbox)
- set the remote filter to "-a" (textbox) WITHOUT the quotes
- OK
- OK or Connect

In WSFTP
Right click on the connection before logging on, select "properties", then select the "startup" tab. On this screen you shall see a box that says "Remote file mask". In this box place "-al", then log in.

In Fetch
Step 1: Open the Preferences.
Step 2: Click on the 'Misc' tab
Step 3: Click on the 'Obscure Options' popup menu.
Step 4: Check the 'Send LIST -al to UNIX servers'

In BBEdit
Click the checkbox that says 'Show Files Starting with "."'

In Transmit
Step 1: Open the Preferences.
Step 2: Click on 'Files' in the Toolbar.
Step 3: Check the box that says 'Show all Hidden Files."

In FTP Voyager
Step 1: Select a profile in the FTP Site Profile Manager.
Step 2: Click on the 'Advanced' button.
Step 3: Select the category 'Connection'.
Step 4: Enter "-la" in the Extra LIST Parameter.

In SecureFX
Step 1: Right click on the connection before logging on.
Step 2: Select "properties".
Step 3: Select Category > Options > FTP.
Step 4: On this screen you shall see a box that says "Directory Listing Options". Select the option "All entries", then log in.

In LeechFTP
Step 1: Run Leech FTP
Step 2: Select "File", "Options"
Step 3: Select "Transfers" tab
Step 4: In the "List Command" box enter "LIST-a" (no quotes)
Step 5: Click "Accept"
Step 6: Log in and view directory, all is well.

In IE:
Login to your ftp site
In the menu bar, click Tools -> Folder Options
Click tab "View"
Under Files and Folders is a section called "Hidden Files and Folders"
Click "Show hidden files and folders"

AceFTP:
Step 1: Go to the site profiles manager (Ctrl+W)
Step 2: Go to the properties of the site (left click -> properties, or select and Alt+Enter)
Step 3: Click on "Folders" in this list on the left
Step 4: Under "Folder Listing Command:", select the "Use custom value:" radio button and type "LIST -al" into the dropdown menu immediately below.
Step 5: Click "OK"

In FileZilla:
Edit -> Settings -> Remote file list
Be sure that "Always show hidden files" is checked.

In fireFTP
Step 1: Run fireFTP
Step 2: Select Preferences (Alt+R)
Step 3: Select the "General" tab
Step 4: Select "Show Hidden FIles"
Step 5: Click "OK"

Thursday, October 21, 2010

Compare the tracking of document.referrer between the browsers

When you use document.referrer, you may track refer urls to your website. However, there are some differences between the browsers as the following:

Link Click:

  • Firefox: Yes
  • Chrome: Yes
  • IE: Yes
Popup & Popunder:
  • Firefox and Chrome: Yes
  • IE: No
(Yes: may be track, No: not available)

Sunday, September 12, 2010

How to change the Remote Desktop port

By default, Remote Desktop listens on port 3389 (via TCP). Using a quick registry tweak, you can change that to any other valid port. The following steps describe the process:

1. Start Registry Editor (by default, this is located at c:\windows\regedit.exe).
2.Go to the following registry key:

HKEY_LOCAL_MACHINE\
System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp

3. Open the PortNumber subkey.
4. Pick the Decimal Base option.
5. Enter the new port number, and then click OK.

Does Remote Desktop send traffic over any other ports?

Primary remote desktop traffic will go over the one port defined above. If sound is enabled, streaming will be attempted over UDP directly. If this connection can't be made, Remote Desktop will stream sound over a virtual channel via the main remote desktop port.

No other ports are used.
Quit Registry Editor and restart your computer.
Make sure the firewall has the new port opened!
(If you do not set access enabled for that specific new port, you wont be able to have access via remote computer)

How to connect to a non-standard remote desktop port

To connect to a different port than the default 3389 RDP port, specify the port using one of the following formats:

* :
example: computer:23389
* :
example: 192.168.1.1:23389

Thursday, August 26, 2010

How do i get ajaxuploader to work with IIS7

If you are using IIS 7.0 Integrated mode you need to use the following code to add uploadmodule into web.config

IIS 7.0 Integrated mode

<configuration>
<system.webServer>
<modules>
<add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
</modules>
</system.webServer>
</configuration>