1

I have a file header where i have created variables for all the paths i need, like this:

$GLOBAL_stylePath = "http://localhost/pspace/css/"; 

(if i shouldn't use http in the above, then how would it be? C://htdocs/xampp/pspace/css/ ???)

include_once "/classes/authorizationUtils.php";
$authorizationUtils = new AuthorizationUtils();

anyways, the includes are messing up everything and giving me errors such as:

Warning: include_once() [function.include-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\pspace\includes\header.php on line 12

how can i enable this configuration in my php.in. i have a variable allow_url_include=off, when i "on" it, no changes happen. and also this:

Warning: include_once() [function.include]: Failed opening 'http://localhost/pspace/classes/authorizationUtils.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\pspace\includes\header.php on line 12
5
  • Are you including CSS files? Also, /classes refers to the filesystem (disk) root, this is probably wrong.
    – netcoder
    Nov 8, 2011 at 0:45
  • no, i m not including the css, just gave that as an example of the variables. classes would be wrong? u mean, any reserved name or what?
    – Nader Khan
    Nov 8, 2011 at 1:11
  • No. You are prepending classes with a slash (i.e.: /classes), which, like I said, probably refers to the filesystem root.
    – netcoder
    Nov 8, 2011 at 1:20
  • ok, any idea on what to do with this:
    – Nader Khan
    Nov 8, 2011 at 1:34
  • Warning: include_once() [function.include]: Failed opening 'authorizationUtils.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\pspace\includes\header.php on line 13
    – Nader Khan
    Nov 8, 2011 at 1:34

2 Answers 2

0
  1. Make sure that you editing the correct php.ini file. Usually there are two php.ini files associated with your installation. One is used for the command line interface php and the other for the server side php. Make sure that you make the changes to both.

  2. Make sure that you restart your webserver after these changes are made.

6
  • what kind of changes? u mean turning allow_url_include to on instead of off in php.in, php.ini-development and php.ini-production? its not working.
    – Nader Khan
    Nov 8, 2011 at 0:44
  • You don't really need to change the one for PHP CLI -- and to be sure you're changing the right one, phpinfo() will show you, among other things, the path of the php.ini file that is being used.
    – jedwards
    Nov 8, 2011 at 0:45
  • Can you also check allow_url_fopen in php.ini. Please set that to "1" Nov 8, 2011 at 2:01
  • i did, not working. and the values are on and off, not 1 and 0.
    – Nader Khan
    Nov 8, 2011 at 2:03
  • Warning: include_once() [function.include]: Failed opening '' for inclusion (include_path='.;C:\xampp\php\PEAR')
    – Nader Khan
    Nov 8, 2011 at 2:03
0

This warning :

Warning: include_once() [function.include]: Failed opening 'http://localhost/pspace/classes/authorizationUtils.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\pspace\includes\header.php on line 12

it means that you try to include file which could not be found in include_path. So, what you need is to define your include_path.

If your directory listing is like this :

  1. c:\xampp\htdocs\pspace\ // as your root
  2. c:\xampp\htdocs\pspace\includes\
  3. c:\xampp\htdocs\pspace\classes\

Try this :

<?php  
    $path1 = '.\includes\';  
    $path2 = '.\classes\';
    set_include_path(get_include_path() . PATH_SEPARATOR . $path1 . PATH_SEPARATOR . $path2);
?>  

Your also can change relative path $path1 = '.\includes\'; to absolute path $path1 = 'c:\xampp\htdocs\pspace\includes\';

Read this to understand more about set_include_path and about include function that always include files based on file path given. Hope this can help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.