[PHP-users 25567] Re: バックグラウンド処理で自プログラムがコールされてしまう。

kimi_yama @ infoseek.jp kimi_yama @ infoseek.jp
2005年 5月 10日 (火) 19:32:51 JST


君山です。
望月様、ありがとうございます。


> 中途半端な投稿してすみませんでした。
とんでもないです。
大事な時間を割いてテストまでして頂いて本当に
ありがとうございます。

> テスト用に syslog.php を用意。
> /var/log/messages に出力してみました。
> 
> [root @ xxxxxx tools]# vi syslog.php
> 
> syslog.php の内容
> 
> <?php
> $access = date("Y/m/d H:i:s");
> syslog(LOG_WARNING,"PHP-TEST: $access");
> ?>
> 
> 実行可能に。(webmaster が アパッチのuser:group)の場合
> [root @ xxxxxx tools]# chown webmaster:webmaster syslog.php
> [root @ xxxxxx tools]# chmod 770 syslog.php
> 
> rootでテスト
> テスト1
> [root @ xxxxxx tools]# /usr/local/bin/php  -f syslog.php
> テスト1結果
> [root @ xxxxxx tools]# tail -f /var/log/messages
> May 10 18:14:42 xxxxxx php: PHP-TEST: 2005/05/10 18:14:42
> 
> テスト2
> [root @ xxxxxx tools]# /usr/local/bin/php  -f syslog.php > /dev/null
> てすと2結果
> [root @ xxxxxx tools]# tail -f /var/log/messages
> May 10 18:14:42 xxxxxx php: PHP-TEST: 2005/05/10 18:14:42
> May 10 18:16:04 xxxxxx php: PHP-TEST: 2005/05/10 18:16:04
> 
> テスト3
> [root @ xxxxxx tools]# /usr/local/bin/php  -f syslog.php > /dev/null &
> [13] 1650
> テスト3結果
> [root @ xxxxxx tools]# tail -f /var/log/messages
> May 10 18:14:42 xxxxxx php: PHP-TEST: 2005/05/10 18:14:42
> May 10 18:16:04 xxxxxx php: PHP-TEST: 2005/05/10 18:16:04
> May 10 18:17:31 xxxxxx php: PHP-TEST: 2005/05/10 18:17:31
> 
> webmasterでテスト
> [webmaster @ xxxxxx tools]# /usr/local/bin/php  -f syslog.php
> 結果
> [root @ xxxxxx tools]# tail -f /var/log/messages
> May 10 18:14:42 xxxxxx php: PHP-TEST: 2005/05/10 18:14:42
> May 10 18:16:04 xxxxxx php: PHP-TEST: 2005/05/10 18:16:04
> May 10 18:17:31 xxxxxx php: PHP-TEST: 2005/05/10 18:17:31
> May 10 18:24:21 xxxxxx su(pam_unix)[1652]: session opened for user
> webmaster by hogehoge(uid=0)
> May 10 18:29:27 xxxxxx php: PHP-TEST: 2005/05/10 18:29:27
> 
> 君山さんのsub.phpがウェブサーバから実行可能で
> ログへの書き込み権限があれば、動くと思います。
sub.phpは、ウェーブからアクセス可能です。
アクセスした場合、ログファイルにもログが追記されています。
アパッチのアクセスログにも残っています。

php.ini 他サーバーの仕様でしょうか?






PHP-users メーリングリストの案内