<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
   <channel>
      <title>WEBアプリケーション開発メモ</title>
      <link>http://drunk.chips.jp/web/</link>
      <description></description>
      <language>ja</language>
      <copyright>Copyright 2012</copyright>
      <lastBuildDate>Sat, 18 Feb 2012 15:14:29 +0900</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>PHP 5.2.17 インストール</title>
         <description>デフォルトで PHP 5.1.6の場合

キーのインストール

# wget http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
# rpm --import RPM-GPG-KEY-jlitka


レポジトリファイルの作成
# vi /etc/yum.repos.d/utterramblings.repo

[utterramblings]
name=Jason&apos;s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
#使用するときだけ1に設定する
#enabled=1
enabled=0
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

インストール
# yum --enablerepo=utterramblings install php

確認
# php -v
PHP 5.2.17 (cli) (built: Sep  1 2011 17:22:41) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
</description>
         <link>http://drunk.chips.jp/web/2012/02/php_5217.html</link>
         <guid>http://drunk.chips.jp/web/2012/02/php_5217.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Sat, 18 Feb 2012 15:14:29 +0900</pubDate>
      </item>
            <item>
         <title>phpでCronを書き換える</title>
         <description>ユーザー単位のcronは/var/spool/cron/　にユーザー名で保存されてるから
ここを書き換えればいい。

しかし、パーミッションが600とか644じゃないと動かない。
cron BAD FILE MODE 

権限あたりが面倒なので
どこか一時的な場所に書き出して /var/spool/cron/以下にコピーするのがいいみたい。
コピー先にあらかじめファイルを作っておき、パーミッションを600にしておく。
上書きしてもパーミッションは引き継がれるため。</description>
         <link>http://drunk.chips.jp/web/2012/01/phpcron.html</link>
         <guid>http://drunk.chips.jp/web/2012/01/phpcron.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Mon, 23 Jan 2012 03:03:41 +0900</pubDate>
      </item>
            <item>
         <title>SE Linuxを無効にする</title>
         <description># echo 0 &gt; /selinux/enforce</description>
         <link>http://drunk.chips.jp/web/2012/01/se_linux_1.html</link>
         <guid>http://drunk.chips.jp/web/2012/01/se_linux_1.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
        
        
         <pubDate>Mon, 16 Jan 2012 00:49:41 +0900</pubDate>
      </item>
            <item>
         <title>デバッグ用メソッド</title>
         <description>　// デバッグ用メソッド
　function trace($str){
　　$_dir = &quot;/home/neo-cosmic/www/gree_botan_develop/cp/app/log/&quot;;
　　//$log_file = $_dir . date(&apos;Y-m-d&apos;) .&apos;.log&apos;;
　　
　　$_date = date(&apos;Y-m-d&apos;);
　　$_d = explode(&apos;-&apos;, $_date);
　　
　　if(!opendir(&quot;{$_dir}/{$_d[0]}&quot;)) mkdir(&quot;{$_dir}/{$_d[0]}&quot;, 0777);
　　//if(!opendir(&quot;{$_dir}/{$_d[0]}/{$_d[1]}&quot;)) mkdir(&quot;{$_dir}/{$_d[0]}/{$_d[1]}&quot;, 0777);
　　//$log_file = $_dir.&quot;{$_d[0]}&quot; .&apos;/&apos;.&quot;{$_d[1]}&quot;.&apos;/&apos;.$_date .&apos;.log&apos;;
　　$log_file = $_dir.&quot;{$_d[0]}&quot; .&apos;/&apos;.$_date .&apos;.log&apos;;
　　
　　$fp = fopen($log_file, &quot;a+&quot;);
　　if (!(empty($fp))) {
　　　flock($fp, LOCK_EX);
　　　fputs($fp, date(&apos;H:i:s&apos;).&apos; : &apos;);
　　　fputs($fp, $str);
　　　fputs($fp, &quot;\n\n&quot;);
　　　flock($fp, LOCK_UN);
　　　fclose($fp);
　　}
　}</description>
         <link>http://drunk.chips.jp/web/2012/01/post_16.html</link>
         <guid>http://drunk.chips.jp/web/2012/01/post_16.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 11 Jan 2012 13:01:28 +0900</pubDate>
      </item>
            <item>
         <title>yum install php-eaccelerator</title>
         <description>レポジトリのインストール
wget http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -Uvh epel-release-6-5.noarch.rpm 

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5.rpm

php-eacceleratorを確認後、インストール
yum list &quot;php-eaccelerator*&quot;
yum install php-eaccelerator
php -v
ls /etc/php.d/

eaccelerator.ini内の値を書き換え
eaccelerator.shm_size = &quot;32&quot;</description>
         <link>http://drunk.chips.jp/web/2011/12/yum_install_phpeaccelerator.html</link>
         <guid>http://drunk.chips.jp/web/2011/12/yum_install_phpeaccelerator.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 28 Dec 2011 11:43:29 +0900</pubDate>
      </item>
            <item>
         <title>PHP内で処理時間を設ける場合</title>
         <description>// 開始時間
$start_time=microtime(true);

//メイン処理

// 終了時間
$end_time=microtime(true);

// 処理時間
$syori_zikan=$end_time - $start_time;

// 60秒たってたら終わりにする
if(intval($syori_zikan)&gt;60) exit;</description>
         <link>http://drunk.chips.jp/web/2011/12/php_35.html</link>
         <guid>http://drunk.chips.jp/web/2011/12/php_35.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 14 Dec 2011 01:17:20 +0900</pubDate>
      </item>
            <item>
         <title>PHP　アクセスした端末を判別する</title>
         <description>　　function getDevice()
　　{
　　　　$carrier = &quot;&quot;;
　　　　if(array_key_exists(&apos;HTTP_USER_AGENT&apos;,$_SERVER)){
　　　　　　$ua = $_SERVER[&apos;HTTP_USER_AGENT&apos;];
　　　　　　if(strstr($ua,&apos;DoCoMo&apos;)){
　　　　　　　　$carrier = &apos;DOCOMO&apos;;
　　　　　　}elseif(strstr($ua,&apos;J-PHONE&apos;) || strstr($ua,&apos;Vodafone&apos;) || strstr($ua, &apos;SoftBank&apos;) || strstr($ua, &apos;MOT&apos;)){
　　　　　　　　$carrier = &apos;SOFTBANK&apos;;
　　　　　　}elseif(strstr($ua,&apos;UP.Browser&apos;) || strstr($ua,&apos;KDDI&apos;)){
　　　　　　　　$carrier = &apos;AU&apos;;
　　　　　　}elseif(strstr($ua,&apos;iPad&apos;)){
　　　　　　　　$carrier = &apos;IPAD&apos;;
　　　　　　}elseif(strstr($ua,&apos;iPhone&apos;)){
　　　　　　　　$carrier = &apos;IPHONE&apos;;
　　　　　　}elseif(strstr($ua,&apos;Android&apos;)){
　　　　　　　　$carrier = &apos;ANDROID&apos;;
　　　　　　}else{
　　　　　　　　$carrier = &apos;PC&apos;;
　　　　　　}
　　　　}else{
　　　　　　$carrier = &apos;PC&apos;;
　　　　}
　　　　return $carrier;
　　}</description>
         <link>http://drunk.chips.jp/web/2011/11/php_34.html</link>
         <guid>http://drunk.chips.jp/web/2011/11/php_34.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 16 Nov 2011 20:48:16 +0900</pubDate>
      </item>
            <item>
         <title>PHP　時刻の比較</title>
         <description>YYYY-MM-DD hh:mm:ss　の書式の2つの日時を比較して差を分で返却するメソッド

function compareTime($date1, $date2) {
　　
　　// 日時を前半と後半に分割
　　$t1 = explode(&quot; &quot;, $date1);
　　// 前半を分割
　　$d1 = explode(&quot;-&quot;, $t1[0]);
　　// 後半を分割
　　$d2 = explode(&quot;:&quot;, $t1[1]);
　　　　
　　// 日時を前半と後半に分割
　　$t2 = explode(&quot; &quot;, $date2);
　　// 前半を分割
　　$d3 = explode(&quot;-&quot;, $t2[0]);
　　// 後半を分割
　　$d4 = explode(&quot;:&quot;, $t2[1]);
　　
　　　　　　　　// hour　　minute　　sec　　　　month　　day　　　　year
　　$dt1 = mktime($d2[0], $d2[1], $d2[2], $d1[1], $d1[2], $d1[0]);
　　$dt2 = mktime($d4[0], $d4[1], $d4[2], $d3[1], $d3[2], $d3[0]);
　　$diff = $dt1 - $dt2;
　　
　　return ceil($diff/60); // 60で割って分で返却
}</description>
         <link>http://drunk.chips.jp/web/2011/11/php_33.html</link>
         <guid>http://drunk.chips.jp/web/2011/11/php_33.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 16 Nov 2011 19:49:19 +0900</pubDate>
      </item>
            <item>
         <title>Services_Amazonのエラー</title>
         <description>Amazon returned invalid HTTP response code 400

こんなエラーコードが帰ってくる場合

サーバーの時計がずれていることが原因かもしれません</description>
         <link>http://drunk.chips.jp/web/2011/11/services_amazon.html</link>
         <guid>http://drunk.chips.jp/web/2011/11/services_amazon.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 09 Nov 2011 01:14:13 +0900</pubDate>
      </item>
            <item>
         <title>Cron結果のメール通知をやめる</title>
         <description>/etc/crontab

MAILTO=root　→　MAILTO=&apos;&apos;</description>
         <link>http://drunk.chips.jp/web/2011/10/cron_1.html</link>
         <guid>http://drunk.chips.jp/web/2011/10/cron_1.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
        
        
         <pubDate>Thu, 06 Oct 2011 10:45:44 +0900</pubDate>
      </item>
            <item>
         <title>CentOS webmin インストール</title>
         <description># wget http://prdownloads.sourceforge.net/webadmin/webmin-1.570-1.noarch.rpm
# rpm -i webmin-1.570-1.noarch.rpm </description>
         <link>http://drunk.chips.jp/web/2011/10/centos_webmin_2.html</link>
         <guid>http://drunk.chips.jp/web/2011/10/centos_webmin_2.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
        
        
         <pubDate>Wed, 05 Oct 2011 14:40:30 +0900</pubDate>
      </item>
            <item>
         <title>Cent OS gitインストール</title>
         <description># rpm -qpl http://repo.webtatic.com/yum/centos/5/latest.rpm
# rpm -ivh http://repo.webtatic.com/yum/centos/5/latest.rpm
# yum install --enablerepo=webtatic git

# git --version
git version 1.7.6.1
</description>
         <link>http://drunk.chips.jp/web/2011/10/cent_os_git.html</link>
         <guid>http://drunk.chips.jp/web/2011/10/cent_os_git.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
        
        
         <pubDate>Mon, 03 Oct 2011 16:03:17 +0900</pubDate>
      </item>
            <item>
         <title>Cent OSのアップデート</title>
         <description># cat /etc/redhat-release
CentOS release 5.3 (Final)

# yum clean all
# yum update glibc\*
# yum update yum\* rpm\* pyth\*
# yum clean all
# yum update mkinitrd nash
# yum update selinux\*
# yum update

# cat /etc/redhat-release
CentOS release 5.7 (Final)</description>
         <link>http://drunk.chips.jp/web/2011/10/cent_os.html</link>
         <guid>http://drunk.chips.jp/web/2011/10/cent_os.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
        
        
         <pubDate>Mon, 03 Oct 2011 15:53:55 +0900</pubDate>
      </item>
            <item>
         <title>PHPデバッグ用メソッド</title>
         <description>function trace($str){
	
	$log_file = PATH_TO_LOG_DIR . date(&apos;Y-m-d&apos;) . &apos;.log&apos;;
	$fp = fopen($log_file , &quot;a+&quot;);
	
	if (!(empty($fp))) {
		flock($fp, LOCK_EX);
		fputs($fp, date(&quot;Y-m-d H:i:s&quot;).&quot;\n&quot;);
		fputs($fp, $str.&quot;\n&quot;);
		flock($fp, LOCK_UN);
		fclose($fp);
	}
}

trace(文字列);　　でログを出力。
ちょっとしたデバッグ用に</description>
         <link>http://drunk.chips.jp/web/2011/09/php_32.html</link>
         <guid>http://drunk.chips.jp/web/2011/09/php_32.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 28 Sep 2011 00:31:05 +0900</pubDate>
      </item>
            <item>
         <title>phpMyAdminでレコードの更新、削除、DUMPができない場合</title>
         <description># chmod 777 -R /var/lib/php/session/

セッション書き込みディレクトリに書き込めない場合に動作不良が起こるようです。</description>
         <link>http://drunk.chips.jp/web/2011/09/phpmyadmindump.html</link>
         <guid>http://drunk.chips.jp/web/2011/09/phpmyadmindump.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">MySQL</category>
                  <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
        
        
         <pubDate>Wed, 28 Sep 2011 00:06:46 +0900</pubDate>
      </item>
      
   </channel>
</rss>

