<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ststyle.net &#187; PHP</title>
	<atom:link href="http://www.ststyle.net/weblog/archives/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ststyle.net/weblog</link>
	<description>Just another ststyle techlog</description>
	<lastBuildDate>Mon, 19 Jul 2010 13:53:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP GDインストール</title>
		<link>http://www.ststyle.net/weblog/archives/461</link>
		<comments>http://www.ststyle.net/weblog/archives/461#comments</comments>
		<pubDate>Fri, 23 Oct 2009 07:57:03 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[Install]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=461</guid>
		<description><![CDATA[PHPにて画像関連を扱うためのライブラリのインストール
GD関連ライブラリのインストール
zlib のインストール
PNG のインストール
※zlib などの位置を指定するために、Makefile を編集します。
次に、 [...]]]></description>
			<content:encoded><![CDATA[<p>PHPにて画像関連を扱うためのライブラリのインストール</p>
<p>GD関連ライブラリのインストール</p>
<h3>zlib のインストール</h3>
<pre class="brush: bash; auto-links: false;">
su -
cd /usr/local/src
tar xzvf zlib-1.1.4.tar.gz
cd zlib-1.1.4
./configure --shared
make

su
# make install
</pre>
<h3>PNG のインストール</h3>
<p>※zlib などの位置を指定するために、Makefile を編集します。</p>
<pre class="brush: bash; auto-links: false;">

cd /usr/local/src
tar xvzf libpng-1.0.15.tar.gz
cd libpng-1.0.15
cp scripts/makefile.linux Makefile

vi Makefile

-*-*-*-*-*-*-*-*-*-*-*-*-*
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
-*-*-*-*-*-*-*-*-*-*-*-*-*

make
make install

<pre class="brush: bash; auto-links: false;"></pre>


&lt;h3&gt;jpeg のインストール&lt;/h3&gt;
<pre class="brush: bash; auto-links: false;"></pre>


cd /usr/local/src
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
</pre>
<p>次に、configure を実行します。<br />
共有ライブラリもコンパイルしたい場合は、<br />
&#8211;enable-shared オプションをつけます。</p>
<pre class="brush: bash; auto-links: false;">

./configure --enable-shared
make
make install
</pre>
<p>-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br />
!!!エラー発生の場合!!!</p>
<p>※そのようなファイルやディレクトリはありません<br />
make: *** [install] エラー 1</p>
<p>::対処法::<br />
libtoolをコピーし実行権限を付与する（エラーでないよといわれる）</p>
<pre class="brush: bash; auto-links: false;">

cp /usr/local/src/libtool /usr/local/src/jpeg-6b/.
chmod 777 /usr/local/src/jpeg-6b/libtool

/usr/local/man/man1 ディレクトリが存在しない場合は
/bin/install: cannot create regular file `/usr/local/man/man1/cjpeg.1&#039;:
No such file or directory
のようなエラーが出ると思います．この場合は
::対処法::
install -d /usr/local/man/man1
</pre>
<p>-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*</p>
<pre class="brush: bash; auto-links: false;">

install -d /usr/local/man/man1

もう一回
make install
</pre>
<p>gd のインストール<br />
最後に、gd ライブラリのコンパイルです。<br />
まず、ソースを展開し、展開したディレクトリに移動します。</p>
<pre class="brush: bash; auto-links: false;">
cd /usr/local/src
tar xzvf gd-1.8.4.tar.gz
cd gd-1.8.4
</pre>
<p>以下の//部は実行していません<br />
//TTF、Xpm、FreeType などのライブラリを持っていて、<br />
それらの機能を組み込みたい場合は、Makefile を変更してください。<br />
また、コンパイルオプションを変更したい場合も、<br />
直接 Makefile を変更する必要があります。</p>
<p>//CFLAGS=-O2 -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_XPM -DHAVE_LIBTTF<br />
//LIBS=-lgd -lpng -lz -lm -ljpeg -lXpm -lX11 -lttf<br />
//変更が終わったら、make します。<br />
//&gt; make</p>
<p>root ユーザになってインストールを行います。</p>
<pre class="brush: bash; auto-links: false;">

make
make install
</pre>
<p>あとはPHPインストール時に</p>
<p>configureのオプション指定を行えばOKです。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/461/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>freetype インストール</title>
		<link>http://www.ststyle.net/weblog/archives/347</link>
		<comments>http://www.ststyle.net/weblog/archives/347#comments</comments>
		<pubDate>Tue, 20 Oct 2009 06:17:57 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[freetype]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=347</guid>
		<description><![CDATA[freetypeのインストール
]]></description>
			<content:encoded><![CDATA[<h3>freetypeのインストール</h3>
<pre class="brush: bash; auto-links: false;">

# tar xzvf freetype-2.x.x.tar.gz
# cd freetype-2.x.x
# ./configure --enable-shared
# make
# make install
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/347/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP インストール</title>
		<link>http://www.ststyle.net/weblog/archives/330</link>
		<comments>http://www.ststyle.net/weblog/archives/330#comments</comments>
		<pubDate>Tue, 20 Oct 2009 04:21:30 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[Install]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=330</guid>
		<description><![CDATA[PHPのインストール
公式サイトからPHPのソースファイルをダウンロードします.
ソースディレクトリに配置します(/usr/local/src等)
※オプションに明記しているモジュールは事前にインストールを済ませておく必 [...]]]></description>
			<content:encoded><![CDATA[<p>PHPのインストール</p>
<p>公式サイトからPHPのソースファイルをダウンロードします.</p>
<p>ソースディレクトリに配置します(/usr/local/src等)</p>
<p>※オプションに明記しているモジュールは事前にインストールを済ませておく必要があります。</p>
<p>※gettext, ftpはnagiosQLで使用</p>
<pre class="brush: bash; auto-links: false;">

cd /usr/local/src
wget http://jp.php.net/get/php-5.3.0.tar.gz/from/this/mirror
tar xvzf php-5.3.0.tar.gz
cd php-5.3.0

&#039;./configure&#039; \
&#039;--with-apxs2=/usr/local/apache/bin/apxs&#039; \
&#039;--with-pgsql=/usr/local/pgsql&#039; \
&#039;--with-mysql=/usr/local/mysql&#039; \
&#039;--with-zlib&#039; \
&#039;--with-zlib=/usr&#039; \
&#039;--with-zlib-dir=/usr/local/lib&#039; \
&#039;--with-gd&#039; \
&#039;--enable-gd-native-ttf&#039; \
&#039;--with-jpeg-dir=/usr/local/lib&#039; \
&#039;--with-freetype-dir=/usr/local/lib&#039; \
&#039;--with-png-dir=/usr/local/lib&#039; \
&#039;--enable-mbstring&#039; \
&#039;--enable-mbregex&#039; \
&#039;--enable-zend-multibyte&#039; \
&#039;--enable-shared&#039; \
&#039;--enable-calendar&#039; \
&#039;--enable-exif&#039; \
&#039;--enable-pcntl&#039; \
&#039;--enable-bcmath&#039; \
&#039;--enable-ftp&#039; \
&#039;--enable-sockets&#039; \
&#039;--with-gettext&#039; \
;

&#039;--with-oci8-instant-client=/usr/lib/oracle/11.1/client/lib/&#039; \

make

make install
</pre>
<h3>PHPの再コンパイル</h3>
<pre class="brush: bash; auto-links: false;">

.configure .......................

make clean
make
make install
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/330/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPをcron(コマンドライン)で実行</title>
		<link>http://www.ststyle.net/weblog/archives/247</link>
		<comments>http://www.ststyle.net/weblog/archives/247#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:21:11 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=247</guid>
		<description><![CDATA[PHPをcron(コマンドライン)で実行
やり方は２パターンあります。
１]phpスクリプトの行頭にphpプログラムのファイルパスを記述する
#!/usr/bin/php -q
(-q :: Quiet-mode.  S [...]]]></description>
			<content:encoded><![CDATA[<h2>PHPをcron(コマンドライン)で実行</h2>
<p>やり方は２パターンあります。</p>
<p>１]phpスクリプトの行頭にphpプログラムのファイルパスを記述する</p>
<p>#!/usr/bin/php -q<br />
(-q :: Quiet-mode.  Suppress HTTP Header output.)</p>
<p>2]ｐｈｐプログラムにphpスクリプトを引数として渡して実行する</p>
<p style="padding-left: 30px;">usr/bin/php test.php</p>
<p style="padding-left: 30px;">PATHが通っていれば</p>
<p style="padding-left: 30px;">php test.php</p>
<p>ここでは私がいつも行うやり方を備忘録として&#8230;</p>
<h3>準備</h3>
<p style="padding-left: 30px;">/usr/local/bin/phpだとパスが長いのでちょっとでも短くしたいので</p>
<p style="padding-left: 30px;">/usr/bin/phpにシンボリックリンクします</p>
<p style="padding-left: 30px;">まずはリンク先にｐｈｐがあるかどうかの確認</p>
<p style="padding-left: 30px;">
<pre class="brush: bash; auto-links: false;">&lt;/p&gt;

&lt;p style=&quot;padding-left: 30px;&quot;&gt;su -
cd /usr/bin
find php
find: php: そのようなファイルやディレクトリはありません
&lt;p style=&quot;padding-left: 30px;&quot;&gt;</pre>
</p>
<p style="padding-left: 30px;">※もし既に/usr/bin/phpが存在する場合はrpmなどで<br />
インストール済みの物なのでリネームor削除する</p>
<p style="padding-left: 30px;">ソースコンパイルでインストールしたPHPで</p>
<p style="padding-left: 30px;">シンボリックリンクを張る</p>
<pre class="brush: bash; auto-links: false;">

su -

ln -s /usr/local/bin/php /usr/bin/php
</pre>
<h3>テスト用のtest.phpを作成</h3>
<pre class="brush: php; auto-links: false;">

#!/usr/bin/php -q
&amp;lt;?php
echo &quot;Hello Test&quot;;
?&amp;gt;
</pre>
<h3>実行権限を付与</h3>
<pre class="brush: bash; auto-links: false;">

chmod 700 test.php
</pre>
<p>#実行してみる<br />
./test.php</p>
<p>→”Hello Test&#8221; と表示されればOK!<br />
これをスケジューリングしたい場合には</p>
<p>Cronに登録</p>
<p>(例: 毎日8:00に起動)</p>
<pre class="brush: bash; auto-links: false;">

crontab -e

00 08 * * * /home/sv01/bash/test.php
</pre>
<h3>引数の受け渡し</h3>
<p>PHPをコマンドラインで実行すると、コマンドラインで与えた引数の情報が<br />
$argc、$argvという変数に格納されます。</p>
<p>$argc : 引数の数<br />
$argv : 引数が格納された配列</p>
<p>普通、最低でも引数としてファイル名が指定されているので、</p>
<p>$argc : 1<br />
$argv[0] : ファイル名(パス)</p>
<p>となるはずです。</p>
<p>例えば、<br />
(test.php)</p>
<pre class="brush: php; auto-links: false;">
#!/usr/bin/php -q
&amp;lt;?php
for ($i = 0; $i &amp;lt; $argc; $i++) {
echo $i, &quot; : &quot;, $argv[$i], &quot;\n&quot;;
}
?&amp;gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/247/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-自作フレームワーク</title>
		<link>http://www.ststyle.net/weblog/archives/1</link>
		<comments>http://www.ststyle.net/weblog/archives/1#comments</comments>
		<pubDate>Tue, 06 Oct 2009 06:25:07 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=1</guid>
		<description><![CDATA[自作で作成しているフレームワークのindex.php
]]></description>
			<content:encoded><![CDATA[<p>自作で作成しているフレームワークのindex.php</p>
<pre class="brush: php; auto-links: false;">
/**
* index.php
*
* This Source File is Top Page
*
* @copyright Seiji Tsukioka All rights reserved.
* @author&nbsp;&nbsp;&nbsp; Seiji Tsukioka
* @update&nbsp;&nbsp;&nbsp; 2009-08-14
*/
define (APP_PATH, &quot;../webapp/&quot;);
require_once APP_PATH . &#039;core/LoadManager.class.php&#039;;
LoadManager::execute();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
