• PHP Help General Help
  • [RESOLVED] don't need an include_path, want php to search for included files relative to root

I don't want php to search for an include_path. I want it to search on the relative directory.
The included files are local to where they are needed. All I need to do is document this system. I don't need to develop anything further so I don't need a functioning include_path but I need to remove the errors to get it to work.

How can I change include_path or hard wire it in the index.php to search for $_Server['Document_Root'] but on windows? I commented out all the include_paths in php_ini. There were two php.ini's on Wamp server. One in apache and one in php. Not sure why there are two in Wamp, but I commented out all include_paths. It is still defaulting to (include_path='.;C:\php\pear') can I make it default to the root directory? That should fix my problem? Thanks.

Below is the scripts that get the error in the root 'www' directory in Wamp

conduit-local/public/index --> require'../application/bootstrap.php';
my_app/application/bootstrap --> require_once 'intializer.php& Zend/Loader/Autoloader.php;

ERROR Msgs:
Warning: require_once(C:\php\pear\Zend\Controller\Plugin\Abstract.php): failed to open stream: Permission denied in C:\wamp\www\myapp\application\Initializer.php on line 9
Call Stack
( ! ) Fatal error: require_once(): Failed opening required 'Zend/Controller/Plugin/Abstract.php' (include_path='.;C:\php\pear') in C:\wamp\www\myapp\application\Initializer.php on line 9

so it opens initializer.php and stops on line 9 trying to find the include_path and its defaulting to a wamp directory which is not relative.

thanks,

    I got a suggestion that the error is the directory structure is not in order not the include_path. I will get someone to give me the right structure for the zend libraries to see if that fixes the errors but I have one other question. In WAMP there was two php.ini. One in the apache conf directory which is what get_info tells me. The other php.ini is in the php directory and that one go pear installed an include path that is bypassed completely. So just to see if the include_path was the reason for the error I gave above I commented all the include paths out including the windows include_path. It still defaults to c:\pear\php; or something so my question is where is the default include_path coming from? thanks,

      Yeah, I think something you are including is then trying to include something else, and that something else is not where the first something thinks it should be. 🙂

        I typically design an application with a config file, and that contains some path settings, and then includes are called using that variable:

        include $config['include_path']."/somefile.php";

          I notice it doesn't say file not found but rather permission denied. I would actually be looking at the permissions on the folder/file rather than the settings including it.

            Hello thanks for the input. I pretty much changed every file from wamp folder on down with access to everyone. I am still getting the permissions error. Why would you have a permissions error on wamp anyway? should be all set up for you. I made one change. I added an include_path to php.ini c:\php[ear\zend I changed all the permissions for everyone on that folder. Here is my windows environment path variable:
            C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\wamp\bin\php\php5.5.12;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\

            Here is the error:

            ( ! ) Warning: require_once(C:\wamp\www\conduit-local\application\Zend\Controller\Plugin\Abstract.php): failed to open stream: Permission denied in C:\wamp\www\conduit-local\application\Initializer.php on line 9
            Call Stack

            Time Memory Function Location

            1 0.0020 235448 {main}( ) ..\index.php:0
            2 0.0120 599144 require( 'C:\wamp\www\conduit-local\application\bootstrap.php' ) ..\index.php:10
            3 0.0140 622848 require_once( 'C:\wamp\www\conduit-local\application\Initializer.php' ) ..\bootstrap.php:9

            ( ! ) Fatal error: require_once(): Failed opening required 'Zend/Controller/Plugin/Abstract.php' (include_path='.;c:\php\pear\zend') in C:\wamp\www\conduit-local\application\Initializer.php on line 9
            Call Stack

            Time Memory Function Location

            1 0.0020 235448 {main}( ) ..\index.php:0
            2 0.0120 599144 require( 'C:\wamp\www\conduit-local\application\bootstrap.php' ) ..\index.php:10
            3 0.0140 622848 require_once( 'C:\wamp\www\conduit-local\application\Initializer.php' ) ..\bootstrap.php:9

            It reflects where I changed the include path. I put the required file in Zend/controller/abstract.php which is what it is complaining about. Probably though like someone said it is looking in two places and is confused. I also tried turning off the default include_path. It keeps looking in there I was not able to figure out how to have it not look in a include_path at all just look locally for the file.

              hello nog
              I don't have to develop, I only have to document the system and keep it working. I can't get past this error.
              I commented out all the ini files that could be an include path. I just want it to look for the Zend framework file which is located in the same directory as bootstrap.php
              The structure is simple, public/index.php which is only points to an include initializer.php file to ../application/bootstrap.php

              In bootstrap it requires some files from Zend folder and they are all there in the same directory as bootstrap.
              require_once 'Initializer.php';
              require_once "Zend/Loader/Autoloader.php";
              Trouble is it is either saying it can't find them or it can't get to them or its looking in the include path instead of in the directory it is in? I also set all the permissions on windows in wamp folder to be read write and execute for everybody.

              is there a way to force it to NOT look for an include path. For example set include_path = ' ';

              I don't know what else to try?

              Why is it saying permission denied on line 0?
              ( ! ) Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

              ( ! ) Fatal error: Unknown: Failed opening required 'C:/wamp/www/earth/public/index.php' (include_path='.;C:\php\pear') in Unknown on line 0
              Why is it looking in C:\php\pear? Is that the default? how do you change the default?

              thanks very much

                I checked all the permissions from wamp directory level down on windows they are all read write and execute to everybody including users. as long as windows isn't lying to me but I checked in the security panel not just the permissions check box.

                  The original configuration mac hard drive died, there is some configuration I can't replicate. there were virtual hosts. there was an .htaccess file I can't find anywhere but still my directories are read write and execute from the top level. yet it doesn't get to line 0. I don't get it. I should be able to run it on my localhost with the zend framework file in the right directory. its there it just stops for some reason.

                    Wamp index page works phpmyadmin works, info.php works, my local app doesn't work but it works on the server

                      I think I found the error but I can't believe it was this.

                      Just to see if I could hit a file in the application directory, I made a test php page, that only echos hello.
                      However to save time, I copied the bootstrap.php page and just took out the require reference and just echoed hello. The weird thing was i got the same error on that page whether I put it at www level or the app level
                      even with a require or include reference, so it definitely isn't the include path or path to Zend well maybe if I got that far past line 0 I would know. So then I thought a weird thought,
                      maybe the file is corrupted since its a windows zip file.
                      So I made a test echo hello page from notepad. Sure enough, I don't get the error. This drove me wild. So please someone tell me how Windows or Subversion or something
                      could corrupt the files so Wamp can't read it? Does that mean every file in my application has to be rewritten? How can I find the corrupted characters on the page or is there a ini to accept windows carriage returns or what ? thanks

                        Okay, so how are the files getting corrupted? It is in a subversion directory on a mac. The file gets zipped and sent to me. What could fix the files? Also the file has some netbeans project info on it as well. I don't know where to start to really narrow down the issue.

                          Write a Reply...