2011年11月18日 星期五

PHP on IIS 7.0 using FastCGI

Step1 . Install FastCGI

1.In the Windows Start Menu choose "Run:", type "CompMgmtLauncher" and click "Ok";

2.If the "Web Server (IIS)" role is not present under the "Roles" node, then add it by clicking "Add Roles";

3.If the "Web Server (IIS)" role is not present under the "Roles" node, then add it by clicking "Add Roles";

4.Click "Next" and then "Install" and wait for the installation to complete.

Step2 .PHP Install

1.Go to http://tw.php.net/downloads.php Download PHP

2.Select Windows Binaries

3.PHP5.3 VC9X86 Non Thread Safe-Zip

4.Unpack the files to the directory of your choice (e.g. C:\PHP). Rename the php.ini-production file to php.ini.

5.Open the php.ini file. Uncomment and modify the settings as follows:

;cgi.force_redirect = 1 改成 cgi.force_redirect = 0
;cgi.fix_pathinfo=1 改成 cgi.fix_pathinfo=1
;extension_dir = "ext" 改成 extension_dir = "ext"
;fastcgi.impersonate = 1; 改成 fastcgi.impersonate = 1
;extension=php_mbstring.dll 改成 extension=php_mbstring.dll
;extension=php_mysql.dll 改成 extension=php_mysql.dll
extension=php_mysql.dllshort_open_tag= 改成 short_open_tag= On

6.Save php.ini.
7.Open an Command
c:\php\php -info
Step3.Setting IIS
1.In the Windows Start Menu choose "Run:", type "inetmgr" and click "Ok";
2.In the IIS Manager user interface select the server node in the "Connections" tree view;
3.In the "Features View" page open the "Handler Mappings" feature;
4.In the "Actions" pane click "Add Module Mapping...";
5.In the "Add Module Mapping" dialog enter the following:
Request path: *.php
Module: FastCgiModule
Executable: C:\[Path to PHP installation]\php-cgi.exe
Name: PHP_via_FastCGI
6.Click "Request Restrictions" button and then configure the mapping to invoke handler only if request is mapped to a file or a folder;
7.Click OK on all the dialogs to save the configuration.
Step4.Testing PHP
1.creating a phpinfo.php file in the C:\inetpub\wwwroot folder that contains the following code:

<?php

phpinfo();

?>

 
Scenario 1

Error Message:

HTTP Error 500.0 - Internal Server

ErrorError Code: 0x00000000

Solution:

1.check correct syntax
2.<?php…?> is write <?…?> . please open php.ini modify short_open_tag = On.
Scenario 2

Solution:

1.can open php.ini modify
 error_reporting = E_ALL   &  display_errors = On 


2010年11月3日 星期三

MYSQL編碼

mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER_SET_CLIENT=utf8");
mysql_query("SET CHARACTER_SET_RESULTS=utf8");

2010年8月22日 星期日

android findViewById()

findViewById() 這個函式

"Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle)."

也就是只能抓到一開始在onCreate(Bundle)函式中設定的 xml layout

EditText str1=(EditText)textEntryView.findViewById(R.id.username_edit);
EditText str2=(EditText)textEntryView.findViewById(R.id.password_edit); 
String m_username=str1.getText().toString(); 
String m_password=str2.getText().toString();

Java == 與 equal

1.= =

測試物件參考時,唯有當兩個參考指向同一物件時,==運算子的結果才為true,同樣的,唯有當兩個參考指向不同物件時,!=運算子的結果才為true,這兩個運算子的處理與物件的內容無關。需要特別注意的是,在String中使用==,因為Java為節省記憶體,會在某一輪調區中維護唯一的String物件,所以如果在類別裡使用同一字串,Java只會建立一個唯一的字串而已。

2.equals

另一種測試的做法是equalsequals在類別為Java原先就存在時,是比較兩個物件是否為相同類型的類別後再比較其內容值是否相同,是就傳回true,否就傳回false。當要測試的類別是自定類別時,要依自定類別所提供的equals來決定如何比較,如果自定類別沒有覆蓋Objectequals類別的話,就以Objectequals來比較,Objectequals的比較方式如同 = =

2010年3月26日 星期五

mysqladmin: connect to server at 'localhost' failed

Setp 1. service mysql stop

Step 2.mysqld_safe --skip-grant-tables &

Step 3. mysql -u root mysql

Step 4. UPDATE user SET Password=PASSWORD('new password') where USER='root';

Step 5. FLUSH PRIVILEGES;

Step 6. quit

2010年1月13日 星期三

Drupal 6 問題解決之道

Q1 :安裝過程出現錯誤 "Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.15/includes/file.inc on line 902"

A1:修改 file.inc檔案,在902行增加mb_
vi /opt/lam/htdocs/drupal-6.15/include/file.inc
elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {

2010年1月7日 星期四

CentOS 5 VNC Server

Step1. 確認是否有安裝 VNC Server 套件

#rpm -q vnc vnc-server
vnc-server-4.1.2-9.el5

Step2. 修改 vnc server 設定檔

#vi /etc/sysconfig/vncservers
VNCSERVERS="1:root" //
VNCSERVERARGS[1]="-geometry 1024x768"

Step3. 設定VNC密碼

#vncpasswd

Password: //輸入 VNC 密碼
Verify: //再輸入一次 VNC 密碼以確認

Step4. 修改 ~/.vnc/xstartup

#vi ~/.vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER //將此行 mark 拿掉
exec /etc/X11/xinit/xinitrc //將此行 mark 拿

Step5. 啟用VNC Server

#service vncserver start