2010年 1月
Windows 7 でデフォルト共有を使えるようにする
regedit を起動して
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
の下に、以下の値をDWORD8(32)で追加し、値を1にする
LocalAccountTokenFilterPolicy
これで、c$ やらが使える。
Windows7には、ファイアウォールという壁があるので、それらを乗り越えてください。
何もかもをOKにしてはだめですよ。
Windows 7 64ビット版での32ビットODBCの設定
Windows7の64ビット版では、コントロール パネル\すべてのコントロール パネル項目\管理ツール\データ ソース (ODBC)で、32ビットのODBCドライバーが設定できない。
32ビット版のドライバを使う場合は、
%systemdrive%\Windows\SysWoW64\Odbcad32.exe
を使う。
一般には、c:\Windows\SysWoW64\Odbcad32.exe
phpPgAdminの画面が見ずらいので、テーマを変更
themes/default/global.css を変更した
環境はphpPgAdmin 4.2.2 (PHP 5.2.12)
/**
* Default style sheet
*
* $Id: global.css,v 1.45 2007/10/22 15:54:46 ioguix Exp $
*/
/** ELEMENTS */
body, td
{
background-color: #FFFFFF;
margin: 4px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
padding: 0px;
font-size: 10pt
/* font-size: smaller; */ /*0.8em;*/
}
img { border: none; }
div.logo
{
background-color: #CECF9C;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 1em; */
border: none;
border-bottom: 2px solid #000000;
margin-bottom: 2px;
}
body.browser
{
height: 100%;
background-color: #efefef;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*1em;*/
border-right: 1px dashed #c0c0c0;
text-align: left;
}
body.bottombar {
background-color: #CECF9C;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*1em;*/
text-align: left;
}
p.message {
color: blue;
}
p.comment {
font-style: italic;
}
h2
{
color: #666633;
font-size: medium; /*1.3em;*/
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
border: 2px solid #E6E6CC;
background-color: #F3F3E9;
padding: 2px 1em;
margin: 0 0 1ex 0;
}
h3
{
color: #666633;
font-size: small;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
}
table.error
{
background-color: #E6E6CC;
}
table.error td {
background-color: #E6E6CC;
}
table.navbar
{
background-color: #E6E6CC;
}
table.navbar td
{
height: 25px;
color: #000000;
background-color: #F3F3E9;
text-align: center;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 0.9em */
font-weight: bold;
}
table.navbar td.active
{
background-color: #E6E6CC;
}
th.data
{
color: #000000;
background-color: #E6E6CC;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 0.9em */
}
th.data a:active, th.data a:link, th.data a:visited, th.data a:hover
{
font-weight: bold;
}
.left
{
text-align: left;
}
td.dat
{
color: #ff0;
text-align: center;
}
th.required
{
text-decoration: underline;
}
td.topbar
{
background-color: #CECF9C;
margin: 0px 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*0.8em;*/
text-align: left;
}
ul.toplink,ul.navlink
{
list-style: none;
margin:0;padding:0;
}
ul.navlink{margin:20px 0}
ul.toplink li, ul.navlink li
{
display:inline;
border-left:1px solid #000000;
margin:0;padding: 0 2px 0 5px;
}
ul.toplink li:first-child, ul.navlink li:first-child {
border: none;
padding-left:0;
}
td.data1
{
color: #000000;
background-color: #F3F3E9;
text-align: left;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.data2
{
color: #000000;
background-color: #E6E6CC;
text-align: left;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.data3
{
color: #000000;
background-color: #F3F3E9;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.opbutton1
{
color: #000000;
background-color: #F3F3E9;
border-top: 1px solid #FFFFFF;
border-right: 1px solid #706D41;
border-bottom: 1px solid #706D41;
border-left: 1px solid #FFFFFF;
cursor: pointer;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
padding-left: 6px;
padding-right: 6px;
text-align: center;
}
td.opbutton2
{
color: #000000;
background-color: #E6E6CC;
border-top: 1px solid #FFFFFF;
border-right: 1px solid #706D41;
border-bottom: 1px solid #706D41;
border-left: 1px solid #FFFFFF;
cursor: pointer;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
padding-left: 6px;
padding-right: 6px;
text-align: center;
}
.topbar {
border: 2px solid #CECF9C;
}
.topbar, .topbar * {
background-color: #CECF9C;
}
.topbar .platform, .topbar .host, .topbar .username {
font-weight: bold;
}
.topbar, .trail {
margin-bottom: 2px;
}
.topbar, .trail, .tab {
padding: 2px 1ex;
}
.trail, .tab {
border: 2px solid #E6E6CC;
background-color: #F3F3E9;
}
.trail .crumb {
background-color: #F3F3E9;
}
.crumb, .tab {
vertical-align: top;
}
.crumb .icon {
vertical-align: middle;
margin: 0 2px;
}
table.tabs {
width: 100%;
border-collapse: collapse;
margin-bottom: 1ex;
}
.tab {
text-align: center;
}
.tabs .active {
background-color: #E6E6CC;
}
.tab .icon {
display: block;
}
a:active
{
color: #989973;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: normal;
text-decoration: underline;
}
a,a:link
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a:visited
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a:hover
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a.navlink:link, a.toplink:link, ul.navlink li a, ul.toplink li a
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:visited, a.toplink:visited, ul.navlink li a:visited, ul.toplink li a:visited
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:hover, a.toplink:hover, ul.navlink li a:hover, ul.toplink li a:hover
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:active, a.toplink:active, ul.navlink li a:active, ul.toplink li a:active
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
.active a
{
font-weight: bold;
}
a.help
{
color: #E68800;
font-size: smaller;
vertical-align: super;
text-decoration: none;
}
pre
{
font-size: 110%;
}
pre.data
{
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 100%;
}
.intro li
{
font-weight: bold;
}
/* Syntax highlighting */
.comment {color: #008080}
.keyword {color: #FF8000}
.literal {color: #808080}
/* Browser Tree using XLoadTree 2 */
.refreshTree {
float:right;
text-align:right;
padding: 0 3px;
}
.webfx-tree-row {
white-space: nowrap;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
}
.webfx-tree-children {
background-repeat: repeat-y;
background-position-y: 1px !important; /* IE only */
}
.webfx-tree-row img {
vertical-align: middle;
}
.webfx-tree-item-label {
margin-left: 0.5ex;
}
.webfx-tree-icon {
margin-left: 1px;
}
.webfx-tree-hide-root {
display: none;
}
.arg_icon {
padding-right:5pt;
padding-left:5pt;
}
.arg_tr_pc {
}
.ac_field {
border:1px solid #D9D95F;
}
.normal_field {
}
PHP5 XMLファイルと配列を相互に受け渡しをするクラス
<?php
/**
* クラスの説明
* XMLファイルと配列を相互に受け渡しをするクラス
*
* @author k.t
* @since PHP 5.0
*/
class com_xml_array
{
/**
* Arrayに入っている内容を、XMLファイルに書き込む。値はキー値が’text’に格納する。
* @param string $file 書き込むファイル名
* @param Array $array 内容が入ったArray
* @return string
*/
public static function save_array2xml($file,$array,$xml_root_name=’xml_root’)
{
$dom = new DomDocument(‘1.0′,’UTF-8′);
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$parent = new domElement($xml_root_name);
$dom->appendChild($parent);
self::array2xml_recursive($array,$parent,$dom);
$dom->save($file);
}
/**
* 再帰的にarrayの内容をxmlにする.
* @param Array $array
* @param DOMNode $parentarray
* @return
*/
private static function array2xml_recursive($array,&$parent,&$dom)
{
foreach($array as $key => $value)
{
if(is_array($value))
{
$node = $dom->createElement($key);
$parent->appendChild($node);
self::array2xml_recursive($value,$node,$dom);
}
else if(is_string($value))
{
if($key==’text’)
{
$node = $dom->createTextNode($value);
$parent->appendChild($node);
}
else
{
$node = $dom->createElement($key,$value);
$parent->appendChild($node);
}
}
else
{
$node = $dom->createElement($key,$value);
$parent->appendChild($node);
}
}
}
/**
* XMLファイルを読み込んで、Arrayに格納する。ノード中に子ノードを作る場合で、そのタグの値を設定する場合は、キー値が’text’に値を格納する。
* @param string $file ファイル名
* @return Array 読み込んだ結果が入った配列
*/
public static function load_xml2array($file)
{
$dom = new DomDocument(‘1.0′,’UTF-8’);
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
try
{
$ret=$dom->load($file);
if(!$ret) return null;
}
catch(Exceptuin $ex)
{
throw new Exception($ex->getMessage());
}
$array = null;
$root = $dom->childNodes->item(0)->childNodes;
foreach($root as $node)
{
$node_type = $node->nodeType;
if($node_type==XML_TEXT_NODE)
{
$array[‘text’] = $node->nodeValue;
}
else
{
self::xml2array_recursive($node,$array[$node->nodeName]);
}
}
return $array;
}
/**
* 再帰的にXMLの構造をArrayに格納する.
* @param DOMNode $pnode
* @param Array $array
*/
private static function xml2array_recursive($pnode,&$array)
{
if(!$pnode->hasChildNodes()) return;
$child_nodes = $pnode->childNodes;
if($child_nodes->length == 0) return;
foreach($child_nodes as $node)
{
$node_type = $node->nodeType;
if($node_type==XML_TEXT_NODE)
{
$array[‘text’] = $node->nodeValue;
}
else
{
self::xml2array_recursive($node,$array[$node->nodeName]);
}
}
}
}
?>
CentOS5上でのPHP環境のインストール
- CentOS5の環境を確認
yum -y update を行った後の環境です。
# cat /etc/redhat-release
CentOS release 5.4 (Final) - APACHEのインストール
# yum -y install httpd
バージョンの確認
# httpd -v
Server version: Apache/2.2.3
Server built: Nov 12 2009 18:43:47 - PHPのインストール
phpに関するものはすべてインストールするのですが、本番で使用する場合はいるものだけを選んだほうがよいでしょう。
とりはえずすべてインストールする。
# yum -y install php*
バージョンの確認
# php -v
PHP 5.1.6 (cli) (built: Apr 7 2009 08:00:04)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies - Postgresqlのインストール(データベースにPostgreSQLを使う場合)
postgresqlに関するものはすべてインストールするのですが、本番で使用する場合はいるものだけを選んだほうがよいでしょう。
とりはえずすべてインストールする。
# yum -y install postgresql*
バージョンの確認
# psql –version
psql (PostgreSQL) 8.1.18 - MySqlのインストール(データベースにMySqlを使う場合)
MySqlに関するものはすべてインストールするのですが、本番で使用する場合はいるものだけを選んだほうがよいでしょう。
とりはえずすべてインストールする。
# yum -y install mysql*
# mysqladmin version
mysqladmin Ver 8.41 Distrib 5.0.77, for redhat-linux-gnu on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.77
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 2 days 20 hours 53 min 32 sec
Threads: 1 Questions: 226256 Slow queries: 2 Opens: 178 Flush tables: 1 Open tables: 38 Queries per second avg: 0.912 - APACHE MySQL PostgreSql をOS起動時に起動する設定にする
# chkconfig httpd on
# chkconfig mysqld on
# chkconfig postgresql on - APACHE MySQL PostgreSqlを起動する
# service httpd start
# service mysqld start
# service postgresql start
これで一応すべてインストールは終わり
PHPの動作環境を.htaccess で設定する
httpd.conf に AllowOverride All が設定されていること
.htaccess の内容
<IfModule mod_php5.c>
#インクルードパスの設定
php_value include_path “.:/home/queque/public_html”
php_value mbstring.internal_encoding “UTF-8”
php_value mbstring.http_output “UTF-8”
php_value mbstring.language “Japanese”
php_value date.timezone “Asia/Tokyo”
php_value upload_tmp_dir “/home/iroiro/php_upload”
php_value session.save_path “/home/iroiro/php_session”
php_flag mbstring.encoding_translation Off
#セッションを自動スタートする
php_value session.auto_start “1”
#不用意なエラーレポート出力をさせないようにする
#php_flag display_errors Off
</IfModule>
.htaccessでサブディレクトリ以下をリライトする場合
URL(ドメイン+カソウフォルダ以下のパス)のリダイレクトや置き換えができます。
/etc/httpd/conf/httpd.confの以下の行のコメントが外れていれば使用できます。
LoadModule rewrite_module modules/mod_rewrite.so
リライトのルールは
httpd.conf で書いてもよいのですが、レンタルサーバの場合は.htaccessに書きます。
この場合、httpd.conf に
AllowOverride All
Options に FollowSymLinks
が書かれていること!!