堀田@長崎市です。
From: kaz <okui@xxxxx>
To: php-users@xxxxx
Date: Thu, 24 Jul 2008 22:14:36 +0900
Subject: [PHP-users 33879] PHP をシェルスクリプトとして使用する場合
> require_once( "../config.php" );を使う為にはどうすればいいんで
> しょうか?
> コマンドラインでは使えない仕様なら仕方ありませんが。
使えないということはないはずだと思い、試してみました。
m-hotta@xxxxx:~/test/sub$ php -v|head -1
PHP 5.2.5 (cli) (built: Mar 1 2008 11:52:22)
m-hotta@xxxxx:~/test/sub$ ls
a.php
m-hotta@xxxxx:~/test/sub$ cat a.php
#!/usr/bin/php
<?php
ini_set('include_path', '.');
printf("current include_path = %s\n", ini_get('include_path'));
require_once('../config.php');
?>
m-hotta@xxxxx:~/test/sub$ ls ..
config.php sub
m-hotta@xxxxx:~/test/sub$ cat ../config.php
<?php print("This is config.php\n"); ?>
m-hotta@xxxxx:~/test/sub$ ./a.php
current include_path = .
This is config.php
手元の環境では、使えました。
あとは、php.ini の safe_mode* を調べてみるとか?
--
HOTTA Michihide <hotta@xxxxx>
_______________________________________________
PHP-users mailing list PHP-users@xxxxx
http://ml.php.gr.jp/mailman/listinfo/php-users
PHP初心者のためのページ - 質問する前にはこちらをお読みください
http://oldwww.php.gr.jp/php/novice.php3