2010年4月

How to Unzip Multiple=

When you try:
unzip *.zip

You will get the following error:
caution: filename not matched

When you want to unzip file using wild card, you have two options as follows.

Option # 1 : unzip multiple files using single quote (short version)

Type the command as follows:
$ unzip

Although I think that running PHP and MySQL applications on Linux is more natural and easy to be implemented, sometimes I am still asked to install PHP applications on Windows and use MS SQL Server as database.

My environment is:

  • Windows 2003R2 in VirtualBox
  • IIS 6
  • MS SQL Server 2005

1. Install PHP on IIS:
1.1 Download the PHP:

1.1.1 For the latest version of PHP for Windows, please go to:
http://windows.php.net/download/

1.1.2For the older version of PHP, please go to:
http://www.php.net/releases/

Because I need to install ODBTP Database Connector to connect to MS SQL Server, and the ODBTP said that it only support several version of PHP including 5.1.1, I have to install PHP 5.1.1 instead of the latest version.

When you download, you need to select Windows binary.

1.2 Unzip the the file downloaded and rename move it to a folder under C drive called:
C:\php511

In case you want to test another version of PHP, you can download another one and name it as:
C:\php532 or similar. But you need to change other configuration as below to make it work.

1.3 Setup System Environment:
1.3.1 Right click "My Computer" and select "Properties", or go to "Start" --> "Run" --> Type: sysdm.cpl, a "System Properties" window will pop up.

Select "Advanced" --> "Environment Variables". At "System variables", click "Path", then click "Edit", add "C:\php511" (same as the path in above (2)) at the end. It should be like:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php511

The purpose of this variable is telling system the location of the PHP's Dlls and Executable files.

1.3.2You also need to add a new System variable here. Please click "New", type the "Variable name" as "PHPRC", "Variable value" as "C:\php511".

The purpose of this variable is telling the location of php.ini (PHP Configuration File) to the system.

1.4 Install and Configure IIS Extension to run PHP:
There are 3 options to run PHP on IIS: CGI, ISAPI and FastCGI. Here is the comparison of the three:

Performance (from low to high): CGI < FastCGI < ISAPI
Stability (from low to high): ISAPI < FastCGI < CGI

It is very obvious that the FastCGI is the most balanced option. FastCGI is an IIS Extension provided by Microsoft to make IIS more supportive to PHP and other Open Source applications.

1.4.1 Download and Install FastCGI:

Go to: http://www.server7.iis.net/download/FastCGI to download the x86 or x64 version installation file according to your computer's architecture.

Click the installation file fcgisetup_1.5_rtw_x86.msi and follow the instruction to install it.

1.4.2 Configure the FastCGI to make it work with the PHP you installed:

1.4.2.1 Web Service Extensions --> FastCGI Handler

Open your IIS Manager which is located in "Administrative Tools", or you can just run "inetmgr". In the "Web Service Extensions", you will see a "FastCGI Handler" was already there, also it was "Allowed". It should be always allowed, otherwise your PHP and FastCGI will not work.

PHP IIS

1.4.2.2 Add .php Application Extensions Mapping:

In the same IIS Manager, right click the "Web Sites", select "Properties" --> "Home Directory" --> "Configuration" --> "Mapping",

Windows has a lot of useful commands accessible from Run menu. To invoke the Run box, click on Start button and choose Run, or hold down the Windows key and hit R. Run commands allows simply run applications by typing their name instead of click on an icon. Remember these commands. They can save a lot of your time.

P.S. Some commands may be missed in your system.

Windows Run Command

Command Short description
%allusersprofile% c:\documents and settings\all users
%appdata% c:\documents and settings\%username%\application data
%comspec% command line
%homedrive% installation disk
%homepath% user profile directory (documents and settings\%username%)
%path% system default directories
%programfiles% program files directory
%systemdrive% drive containing the windows root directory
%systemroot% windows directory
%temp% or %tmp% temporary directory, usually c:\documents and settings\%username%\local settings\temp
%userprofile% user profile directory
%windir% windows folder
\ system drive
ac3filter.cpl ac3filter
access.cpl accessibility option control
accwiz accessibility wizard
acrobat adobe acrobat
acrodist adobe distiller
adaptertroubleshooter display adapter troubleshooter
appwiz.cpl add/remove programs control
azman.msc authorization manager
bitlockerwizard bitlocker wizard
calc calculator
certmgr.msc certificate manager
charmap character map
chkdsk check disk utility
ciadv.msc indexing service
cleanmgr disk cleanup utility
cliconfg sql client configaration
clipbrd clipboard viewer
cmd command prompt
colorcpl color management
compmgmt.msc computer management
compmgmtlauncher computer management launcher
conf netmeeting
control access.cpl accessibility options
control admintools administrative tools
control appwiz.cpl,,1 add/remove programs w/add new programs preselected
control appwiz.cpl,,2 add/remove programs w/add remove windows components preselected
control appwiz.cpl,,3 add/remove programs w/set program access & defaults preselected
control color display properties (w/appearance tab preselected)
control control panel
control desktop desktop properties
control folders folder properties
control fonts fonts
control keyboard keyboard properties
control mouse mouse properties
control netconnections network connections
control printers printer and fax options
control schedtasks scheduled tasks
control userpassword2 user accounts
credwiz credential backup and restore wizard
dcomcnfg component services
ddeshare dde share
desk.cpl display properties
devmgmt.msc device manager
dfrg.msc disk defragment
dfrgui defragment user interface
dialer phone dialer
directx.cpl directx control panel
diskmgmt.msc disk management
diskpart disk partition manager
dpinst driver package installer
dpiscaling dpi scaling
drwtsn32 dr. watson system troubleshooting utility
dvdplay dvd player
dxdiag direct x troubleshooter
eudcedit private character editor
eventvwr event viewer
excel microsoft excel
explorer windows explorer
findfast.cpl findfast
firefox firefox browser
firewall.cpl windows firewall
firewallcontrolpanel firewall control panel
firewallsettings firewall settings
fonts fonts folder
freecell free cell card game
frontpg microsoft frontpage
fsmgmt.msc shared folders
fsquirt bluetooth transfer wizard
fvenotify bitlocker notifier
fxscover fax cover sheet editor
gpedit.msc group policy editor
hdwwiz.cpl add new hardware wizard
helpctr help and support center
helppane help pane
hypertrm hyperterminal
icwconn1 internet connection wizard
iexplore internet explorer
iexpress iexpress wizard (self extracting package creator)
imageready adobe imageready
inetcpl.cpl internet properties
inetwiz internet setup wizard
intl.cpl regional and language options
ipconfig /all ip configuration (display connection configuration)
ipconfig /displaydns ip configuration (display dns cache contents)
ipconfig /flushdns ip configuration (delete dns cache contents)
ipconfig /registerdns ip configuration (refreshes dhcp & re-registers dns)
ipconfig /release ip configuration (release all connections)
ipconfig /renew ip configuration (renew all connections)
ipconfig /setclassid ip configuration (modifies dhcp class id)
ipconfig /showclassid ip configuration (display dhcp class id)
iscsicpl iscsi initiator
javaws java control panel
joy.cpl game controllers
jpicpl32.cpl java control panel
logoff logoff from windows
lpksetup language pack installer
lusrmgr.msc local users and groups
magnify windows magnifier
mailto opens default email client
main.cpl mouse properties
mblctr windows mobility center
migwiz files and settings transfer tool
mmsys.cpl multimedia properties control
mobsync microsoft synchronization center
moviemk microsoft movie maker
mrt malicious software removal tool
msaccess microsoft access
msconfig system configuration utility
msdt microsoft support diagnostic tool
mshearts hearts card game
msimn outlook express
msinfo32 system information
msmsgs windows messenger
mspaint microsoft paint
msra remote assistance
mstsc remote desktop
ncpa.cpl network connections
nero nero
netplwiz user accounts
netsetup.cpl network setup wizard
notepad notepad
ntbackup windows backup utility
ntmsmgr.msc removable storage
ntmsoprq.msc removable storage operator requests
nusrmgr.cpl user account management
nvtuicpl.cpl nview desktop manager
odbccp32.cpl odbc data source administrator
optionalfeatures optional features manager
osk on screen keyboard
p2phost people near me
packager object packager
password.cpl password properties
pbrush paint
perfmon performance monitor
photoshop adobe photoshop
pinball pinball game
powercfg.cpl power configuration
powerpnt microsoft powerpoint
prefetch windows prefetcher
presentationsettings presentation settings
printbrmui printer migration
printers printers folder
quicktime.cpl quicktime
quicktimeplayer quicktime player
rasphone remote access phonebook
realplay real player
regedit registry editor
regedit32 registry editor (Windows 2000)
rekeywiz encryption file system
rsop.msc resultant set of policies
sdclt windows backup utility
secpol.msc local security settings
services.msc list of services
sethc accessibility settings
sfc /cachesize=x system file checker utility (set cache size to size x)
sfc /purgecache system file checker utility (purge file cache)
sfc /revert system file checker utility (return scan setting to default)
sfc /scanboot system file checker utility (scan on every boot)
sfc /scannow system file checker utility (scan immediately)
sfc /scanonce system file checker utility (scan once at next boot)
shrpubw windows share creation wizard
shutdown shuts down windows
sigverif file signature verification tool
slui software licensing/windows activation
sndvol sound volume
snippingtool snipping tool (an advanced print screen function)
soundrecorder sound recorder
spider spider solitaire card game
sticpl.cpl scanner and camera control
stikynot sticky notes
sysdm.cpl system properties
sysedit system configuration editor
syskey windows system security tool
system.ini windows loading information
systempropertiesadvanced system properties (advanced preselected)
systempropertiescomputername system properties (computer name preselected)
systempropertiesdataexecutionprevention system properties (data execution prevention preselected)
systempropertieshardware system properties (hardware preselected)
systempropertiesperformance system properties (performance preselected)
systempropertiesprotection system properties (protection preselected)
systempropertiesremote system properties (remote preselected)
tabcal digitizer calibration tool
taskmgr task manager
tcptest tcp tester
telephon.cpl phone and modem options
telnet telnet client
timedate.cpl date and time properties
tourstart windows xp tour wizard
tpminit trusted platform module
tweakui tweak ui
utilman utility manager
verifier driver verifier utility
waaucpl.cpl automatic updates
wab windows address book
wabmig windows address book import utility
wercon problem reports and solutions
wf.msc windows firewall with advanced security
wfs windows fax and scan
wiaacmgr windows picture import wizard
win.ini windows loading information
winchat microsoft chat
winmine minesweeper game
winver windows version
winword microsoft word
wmimgmt.msc windows management infrastructure
wmplayer windows media player
write wordpad
wscui.cpl security center
wuapp windows update app manager
wupdmgr windows update launches
wusa windows standalone update manager

Openfire is a cross-platform java based free Instant Messaging server which implements the XAMPP (Jabber) protocol with extensions. It is very well suited as corporate instant messaging solution.

After I installed the Openfire, I could not login using the admin's password while I am 100% sure that my password was correct. I believe it is a bug of Openfire.

Here is how I recoved the admin's password.

1. Run Openfire Installation Wizard again:
cd /usr/share/openfire/conf
vi openfire.xml
Change the

true

to

false

Run the Installation Wizard again, which is http://your_ip_address:9090/

2. Select MySQL as the Openfire's database during the installation. You may still select HSQLDB instead of MySQL. Because I am not familiar with HSQLDB, I selected MySQL which is easy for me to reset admin's password.

You need to create a new MySQL database and provide the related information in the installation wizard.

After you finished the installation wizard, you can go to next step.

3. Reset admin's password in MySQL:
Login to MySQL and use openfire database. I use the command:
mysql -u root -p openfire

Display the password for the admin user with the query:
select password from ofUser where username = 'admin';

The encryptedPassword field is your admin's password. Change the admin (or any other users) password by setting password field to chosen value and encryptedPassword field to null. For example here is the query to set the admin password to 123456:
update ofUser set password='123456', encryptedPassword = null where username ='admin';

This will change the current admin password to 123456. Remember to change it to a different value after you login to the admin console. This will change your password to null and encryptedPassword to an encrypted string for added security purpose.

4. Restart the Openfire and Login again:
/etc/init.d/openfire restart

http://your_ip_address:9090/

By default remote access to MySQL database server is disabled for security reasons. However, some time you need to provide remote access to database server from home or a web server.

You need type the following commands which will allow remote connections.

Once connected you need to edit the MySQL server configuration file my.cnf.

* If you are using Debian Linux file is located at /etc/mysql/my.cnf location
* If you are using Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location
* If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf

# vi /etc/my.cnf

For example, if your MySQL server IP is 192.168.1.100 then entire block should be look like as follows:

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 192.168.1.100

* bind-address : IP address to bind to.
* skip-networking : Don