- ベストアンサー
includeでのローカルファイルの呼び出しについて
- ローカルファイルの呼び出し方法でエラーが発生しています。
- サーバー管理者から外部ファイルの呼び出しは高負荷がかかるため、ローカルからの呼び出しに変更するよう指示がありました。
- 修正後に「No such file or directory」というエラーが発生しています。
- みんなの回答 (1)
- 専門家の回答
質問者が選んだベストアンサー
関連するQ&A
- PHP PEARパッケージのincludeができない。
PHP PEARパッケージのincludeができない。 お世話になっております。 phpのPEARパッケージのincludeができません。 行うと PHP Warning: require_once(File/CSV.php): failed to open stream: そのようなファイルやディ レクトリはありません in /var/www/httpdocs/XXXXXXXX.php on line 10 PHP Fatal error: require_once(): Failed opening required 'File/CSV.php' (include_path='.:/usr/share/pear') in /var/www/httpdocs/XXXXXXXX.php on line 10 となってしまいます。 エラーメッセージ中の/usr/share/pear上に確かに存在します。 何か他に条件などあるのでしょうか? お願いいたします。
- ベストアンサー
- PHP
- ハッスルサーバーで「Warning: include()」が出てしまっ
ハッスルサーバーで「Warning: include()」が出てしまって困っています。 「Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/ユーザーID/public/www/独自ドメイン/フォルダ/index.php on line 34」と 「Warning: include(http://独自ドメイン/フォルダ/system/adrota/koukoku/bana.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/ユーザーID/public/www/独自ドメイン/フォルダ/index.php on line 34」と 「Warning: include() [function.include]: Failed opening 'http://独自ドメイン/フォルダ/system/adrota/koukoku/bana.php' for inclusion (include_path='.:/usr/local/share/pear') in /home/ユーザーID/public/www/独自ドメイン/フォルダ/index.php on line 34」 と三列がならんで表示されます。 34行目に問題があるのは分かるのですが・・・ エックスサーバーでは、上手く出来るらしいのですが。 ハッスルサーバーでは「フルパス」の表記方法が間違っているのでしょうか? 「絶対パス」は必要ない事ぐらいしかよく分かりません。 「bana.php」のパーミッションは、「644」になっているのですがハッスルサーバーではこの数値が異なるのでしょうか?
- ベストアンサー
- PHP
- Permission denied in
PHPを実行するとWarning: fopen failed to open stream Permission denied inと 表示されてしまいます。 インターネットを使い、調べてはいますが、 上記のように表示してしまいます。 ファイルです。パーミッションは606にしました。 このWarningを表示させないようにするには、どのようにすれば 良いのか教えて頂けると嬉しいです。
- ベストアンサー
- PHP
- includeの仕方について
いつもお世話になっております。 \Apache2\htdocs以下に、 public_htmlーindex.php | ーrrrフォルダーconfig.php ー main.php を作りました。 それぞれ、 index.php <?php $CONF['id'] =1; include('./rrr/config.php'); include($DIR_hoge."main.php"); ?> config.php <?php // main hoge directory $DIR_hoge= '/public_html/rrr/'; ?> main.php <?php echo "main.phpが読み込まれました!<br />"; echo "あなたのIDは、".$CONF['id']."です。"; ?>と書きましたが、index.phpはmain.phpが読み込めていません。 Warning: include(/public_html/rrr/main.php) [function.include]: failed to open stream: No such file or directory in.... 何か書き間違いがあるのでしょうかよろしくお願いします。
- ベストアンサー
- PHP
- includeでファイルが呼び出せない…
ある日突然includeでファイルが呼び出せなくなりました。 include("http://hoge.com/test.php"); 下記のようなエラーになります。 Warning: main(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in……… include("./test.php"); このように相対パスであれば呼び出せます。 なぜなのでしょうか…他のドメインから呼び出せないので困っています…
- 締切済み
- PHP
- includeするファイルの直接呼出しを避けたい
phpにて、includeしているファイル(仮にxxx.incとします)を直接URL指定された場合、エラーとしたいのですが、どのような手段がありますでしょうか?
- ベストアンサー
- PHP
- XAMPPの設定
XAMPPの設定画面で、MySQLのパスワード設定で(localhost/xampp/)、メニューのsecurityをクリックしてセキュリティー画面に入ったんですけど画面が表示されません .Warning: include(lang/jp.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\security\htdocs\index.php on line 13 .Warning: include() [function.include]: Failed opening 'lang/jp.php' for inclusion (include_path='.;C:\php5\pear') in C:\xampp\security\htdocs\index.php on line 13 エラーがでます。どうしたらいいのでしょうか?
- 締切済み
- PHP
- include_pathについて
php.ini内のinclude_pathをinclude_path=".;C:\php\include"と設定してC:\windows\(不安なのでC:\php\にも)に置いているのですが、 なぜかphpinfo()を開いて確認すると".;C:\php5\pear"となっています。 Loaded Configuration File を見ても C:\Windows\php.ini となっていますし。 require_once "DB.php"を実行したときに以下のエラーが出たので、 db.phpのインストールも済んでいることから、include_pathが正しく設定されていないのが問題だと思うのですが・・・ Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\users.php on line 2 Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;C:\php5\pear') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\users.php on line 2 php.ini以外にも設定しなければいけない個所があるのでしょうか?
- 締切済み
- PHP
- XAMPP セキュリティ設定ページにアクセスできない
XAMPPをインストール後、セキュリティ設定ページにアクセスできません Warning: include(lang/jp.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\security\htdocs\index.php on line 13 Warning: include() [function.include]: Failed opening 'lang/jp.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\security\htdocs\index.php on line 13 と出ます。どうしたらいいですかねぇ??
- 締切済み
- フリーウェア・フリーソフト
- 同一phpファイルからのinclude
ってできるんですか? 例えばindex.phpの16行目辺りの文章をDIVで囲ってtitleつけて、それを同一index.phpファイルの100行目辺りにphp includeでまた表示…外部ファイルにして両方にincludeすればいいんですが、できるのかなぁって。 よろしくお願いします。
- 締切済み
- PHP
お礼
ご回答いただきましてありがとうございます。 random.phpのrandom.txtの呼び出し方に問題があったようです。 まずファイル配置については正しくは下記の通りとなります。 www/(705) ├/home(755) │ └index.php(644) └/random(755) ├random.php(644) └random.txt(606) /home フォルダと/random フォルダは並列に配置しており、 /home フォルダ配下に /random フォルダを設置ではありませんでした。 解決方法としてはrondom.phpから以下のようにtxtを呼び出していたのを 下記のようにファイルを呼び出すことにより解決しました。 <?php $Array=file("random.txt"); $Max=sizeof($Array)-1; $n=rand(0,$Max); $Ad=str_replace("\\","",$Array[$n]); $Ad=stripslashes($Ad); print $Ad; ?> ↓ <?php $Array=file("/xxxxxxxx/www/banner/random.txt"); $Max=sizeof($Array)-1; $n=rand(0,$Max); $Ad=str_replace("\\","",$Array[$n]); $Ad=stripslashes($Ad); print $Ad; ?> どうやらローカルファイルの呼び出し方法に間違いがあったようです。 非常に助かりました、ありがとうございます。