I could not get my include_path to work. I read the manual and discovered it doesn't work if you start in safe_mode. I want it to work. I checked my php.ini and it isn't in safe_mode.
include_path = ".:/php/includes"

I'm trying to understand this. I have a mac with leopard. My htdocs root is
/Library/webserver/documents. In that directory I have a php script that calls the Smarty.class.php file testsmarty.php. In the documents directory I have a php/includes directory with the Smarty.class.php in includes folder.
Shouldn't this work.

this is the error:

Warning: require_once(Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /Library/WebServer/Documents/testsmarty.php on line 4

Fatal error: require_once() [function.require]: Failed opening required 'Smarty.class.php' (include_path='.:') in /Library/WebServer/Documents/testsmarty.php on line 4

this is the php file:
<?php
//define('SMARTY_DIR', '/usr/lib/php/Smarty-2.6.26/libs/');
//require_once(SMARTY_DIR . 'Smarty.class.php');
require_once('Smarty.class.php');
$smarty = new Smarty();

?>

I can get it to work with the defined constant SMARTY_DIR but I am really curious about why I can't get the include file to work? I also couldn't get it when I used the full path
include_path=".:/Library/WebServer/documents/php/includes"
or
include_path="./Library/WebServer/documents/php/includes"
of course with the class file in the includes directory.

why can't I get it to work?

    include_path=".:/Library/WebServer/documents/php/includes"
    Try
    include_path=".:/Library/WebServer/Documents/php/includes"

    In some webservers /Documents/ is not same as /documents/

    This is also one reason it is good to keep path folder names lower case.
    At least for all those folders that are inside your website root (htdocs)

    You have done right.
    .../.../php/includes will work if you move your scripts to any other webserver in future.

      I changed it to Documents but that didn't work besides on an Apple the directory paths are not case sensitive. I cannot for the life of me figure out what it is.

      Here is the errror message but it just can't see the include_path in php.ini for some reason.

      FATA error: require_once() [function.require]: Failded opening reqired 'Smarty.class.php' (include_path='.:') in /Library/WebServer/Documents/testsmart.php on line 4.

      I get info.php so php is working. I also tried putting the include directory in /usr/local/php/Smarty-2.6.26/libs directory in the actual php path for Smarty although with the script I am just calling the smarty class so it should be fine in the htdocs directory shouldn't it .

      What else can I check? thanks

        Write a Reply...