file_get_contents works in base script but not in an included script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In PHP4, I am using file_get_contents('file.sql',true) to bring in SQL
queries from files who's directory is on the include path.  It works
fine in the main php scripts (ones accessible through URLs), but when
done in a php script that is included by one of the main scripts I
just get false instead of a string.  The files exist, the include path
is correctly set at all times (I've checked), and the exact same code
works when placed directly in the main php script.  I've been tearing
through documentation for hours.  Is there some quirk, or setting I'm
missing?  Below is an example of what I'm doing.

main.php
<?php
  set_include_path(get_include_path . ':/absolute/path/to/sql');

  include('inc.php');
  $SQL1 = file_get_contents('query.sql',true);
  //$SQL1 == contents of query.sql
?>

includes/inc.php
<?php
  $SQL2 = file_get_contents('query.sql',true);
  //$SQL2 == false
  //My path is still intact here
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux