How to set the include path

The default include path

Windows

      .;C:\xampp\php\PEAR
      

Mac OS X

      .:/Applications/XAMPP/xamppfiles/lib/php
      

Linux

      .:/opt/lampp/lib/php
      

How to get the include path

      $include_path = get_include_path();
      

How to set the include path

Windows

      set_include_path($include_path . ';C:\xampp\htdocs\book_apps\lib');
      

Mac OS X

      set_include_path($include_path . ':/Applications/XAMPP/htdocs/book_apps/lib');
      

Linux

      set_include_path($include_path . ':/opt/lampp/htdocs/book_apps/lib');
      

How to include a file after the include path has been set

      require_once cart.php;
      

Back