[PHP-users 34420] Re: Include ファイルの相対パスと絶対パスについて

Seiichirou Hiraoka flathill @ netspring.co.jp
2009年 3月 12日 (木) 17:17:03 JST


平岡です。

御回答を頂きました皆様、どうもありございました。
5.2.6 で試した所、無事 include 出来るようになりました。

一点だけげせないのは、5.2.5 で改善されたという事ですが、
従来 5.2.4 では同じ環境で問題なく動作しておりました…。
とはいえ、これ以上の追求は無意味ですので、特に気にしない
ように致します。

この度は、どうもありがとうございました。

- flathill

From: 菊澤 正明 <kikuzawa @ cyber-coo.com>
Subject: [PHP-users 34419] Re: Include ファイルの相対パスと絶対パスについて
Date: Thu, 12 Mar 2009 12:23:12 +0900

> 
> 菊澤と申します。
> 
> このバグではないでしょうか?
> http://bugs.php.net/bug.php?id=41822
> 
> PHP5.2.5でFIXとなっています。
> 
> 
> On Thu, 12 Mar 2009 10:53:12 +0900 (JST)
> Seiichirou Hiraoka <flathill @ netspring.co.jp> wrote:
> 
> > 平岡と申します。
> > 
> > Solaris10 SPARC 上で PHP 5.2.4 を使用しております。
> > 先日、PHP の再コンパイル (GD 及び XML モジュールを追加) を
> > 行った所、自作の PHP スクリプト中で Include していたものが
> > 相対パスではなく絶対パスでないと失敗する (Internal Server
> > Error) ようになりました。
> > 
> > 尚、PHP のバージョン及び php.ini の変更は行っておりません。
> > また、PHP を以前のバージョンに戻す (再インストール) 事で、
> > 問題が発生しなくなることも確認しております。
> > 
> > 問題発生前後のコンパイル方法は以下の通りです。
> > # AAA 及び BBB は PREFIX です。
> > 
> > o 発生前 (継続的に利用できていた)
> >   ./configure  --prefix=/AAA --with-config-file-path=/AAA/lib/php \
> >     --enable-memory-limit \
> >     --disable-ipv6 --with-iconv-dir=/BBB \
> >     --with-gettext=/BBB/share/gettext --with-openssl=/BBB \
> >     --with-imap=/src/mail/c-client/imap-2006j \
> >     --with-imap-ssl=/AAA --with-zlib \
> >     --with-apxs2=/AAA/apache/bin/apxs \
> >     --with-pgsql=/AAA/pgsql --with-mysql=/AAA/mysql \
> >     --with-mysqli=/AAA/mysql/bin/mysql_config \
> >     --enable-mbstring --enable-mbregex --with-ldap=/BBB
> > 
> > o 発生後 (再コンパイル後)
> >   ./configure  --prefix=/AAA --with-config-file-path=/AAA/lib/php \
> >     --enable-memory-limit \
> >     --disable-ipv6 --with-iconv-dir=/BBB \
> >     --with-pgsql=/AAA/pgsql --with-mysql=/AAA/mysql \
> >     --with-mysqli=/AAA/mysql/bin/mysql_config --enable-mbstring \
> >     --enable-mbregex --with-ldap=/BBB \
> >     --with-gettext=/BBB/share/gettext --with-openssl=/BBB \
> >     --with-imap=/src/mail/c-client/imap-2006j--with-imap-ssl=/AAA \
> >     --with-zlib --with-apxs2=/AAA/apache/bin/apxs --with-gd=/BBB \
> >     --with-xsl --with-freetype-dir=/BBB --enable-gd-native-ttf \
> >     --enable-gd-jis-conv
> > 
> > 今回 PHP に追加した GD, XML, FreeType のバージョンは以下の通りです。
> >     gd-2.0.35, libxml2-2.6.30, freetype-2.3.8
> > 
> > 実際に問題が発生したスクリプトは、ユーザの public_html 配下に
> > 置かれており、該当箇所は以下の通りです。
> > 
> > include("../lib/global.func");
> > 
> > これを以下のように修正することで、問題が発生しなくなりました。
> > 
> > include("/home/USER/public_html/DIR/lib/global.func");
> > 
> > 問題が発生したときには、以下のような PHP のログが出力されており
> > ました。
> > 
> > [12-Mar-2009 08:39:30] PHP Warning:  include(../lib/global.func) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /home/USER/public_html/DIR/index.php on line 17
> > [12-Mar-2009 08:39:30] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening '../lib/global.func' for inclusion (include_path='.:/AAA/lib/php') in /home/USER/public_html/DIR/index.php on line 17
> > [12-Mar-2009 08:39:30] PHP Fatal error:  Call to undefined function printheader() in /home/USER/public_html/DIR/index.php on line 285
> > 
> > index.php の 17 行目に include が書かれており、それが Permission
> > Denied で読み込まれなかったために、 285 行目でエラーになっており
> > ます。
> > 
> > このことから、相対パスでの Include が出来なくなっていると思われ
> > ますが、php.ini や PHP の設定は変更しておりません。どなたか、
> > アドバイスを頂けませんでしょうか。
> > 
> > php.ini の変更箇所は以下の通りです。
> > 
> > % diff -ruN php.ini.ORG php.ini | grep ^\+
> > +++ php.ini     2009-03-11 18:08:22.908251000 +0900
> > +display_errors = Off
> > +display_startup_errors = On
> > +log_errors = On
> > +error_log = /tmp/php_error.log
> > +post_max_size = 10M
> > +extension_dir = "/AAA/lib/php/extensions"
> > +upload_max_filesize = 10M
> > +mbstring.http_output = EUC-JP
> > +mbstring.encoding_translation = On
> > +mbstring.detect_order = ASCII,JIS,EUC-JP,SJIS,UTF-8
> > 
> > その他必要な情報等ございましたら御連絡下さい。
> > 以上、よろしくお願い致します。
> > 
> > - flathill
> > _______________________________________________
> > PHP-users mailing list  PHP-users @ php.gr.jp
> > http://ml.php.gr.jp/mailman/listinfo/php-users
> > PHP初心者のためのページ - 質問する前にはこちらをお読みください
> > http://oldwww.php.gr.jp/php/novice.php3
> 
> --------------------------------------------
> 菊澤 正明  mailto:kikuzawa @ cyber-coo.com
> (有)サイバー・クー http://www.cyber-coo.com
> phone.03-5785-4658 fax.03-5785-4659
> 
> _______________________________________________
> PHP-users mailing list  PHP-users @ php.gr.jp
> http://ml.php.gr.jp/mailman/listinfo/php-users
> PHP初心者のためのページ - 質問する前にはこちらをお読みください
> http://oldwww.php.gr.jp/php/novice.php3
> 


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