This is my first PHP attempt 🙂

I am trying to open a database connection via PEAR but there is a problem with the include_path. When I load the php page it tells me that DB.php cannot be included. It is included like

include( 'DB.php' );

and this is the error on the page

Warning: Failed opening 'DB.php' for inclusion (include_path='.;D:\php\;D:\php\pear\') 
in G:\developers\projects\active\fhm_st\mit\tsd\scripts\st_srch.php 
on line 170

If I put DB.php in the same directory as st_srch.php it sees the file and includes it. What is wrong???

    From which file are you trying to include db.php?

    Remember that when you include a file you have to write the whole pad to the file or put the file into he directory where the file is located which has the include tag inside.

      The file that has the "include();" is G:\developers\projects\active\fhm_st\mit\tsd\scripts\st_srch.php

      The file that I'm trying to include is D:\php\pear\DB.php

      Shouldn't it look in the "include_path" (in php.ini) for the file to include also instead of me specifying the entire path?

        seems to me that somehow your php.ini is being ignored cause I have no problems with a setting similar to that. Did u try changing other options in ur php.ini to see if the changes do make a diff?

          No, include files should be in the root directory of the site. The include path as you mean it only to include files into php-system files.

            Thanks for the replies 🙂

            jdesilva,
            Yes, I uncommented the line "extension=php_oracle.dll" in php.ini and it found the dll when I used it in a php file. Also, when I change the include_path, it also changes as shown in the error:

            Warning: Failed opening 'DB.php' for inclusion ([b]include_path='.;D:\php\;D:\php\pear'[/b])
            in  G:\developers\projects\active\fhm_st\mit\tsd\scripts\st_srch.php
            on line 170

            tomkleijkers,
            Thx for the reply but I don't understand what you are saying.

            include files should be in the root directory of the site.

            So even include files for database abstraction (i.e. PEAR, ADOD😎 should be in the root directory for each different site?

            The include path as you mean it only to include files into php-system files.

            What are php-system files (maybe some examples)?

            I found a temporary workaround but it can't last. I installed PHP on the G:\ drive instead of D:\ or C:\ and becasue its on the same drive, it finds the file. But now I can't include files from the C:\ or D:\ drives. Could this be a bug? Or do you think it was designed this way for security reasons.

            Thx

              oops! i didn't notice that your web root was on a completely diff hdd.

              this may be a long-shot but try adding all your hdds in the includes path like below

              include_path='.;c:\;d:\;g:\;d:\php\;d:\php\pear'
              

              cause i know on my windows me i had to edit it to

              include_path='.;c:\;c:\php\pear'
              

              instead of the default

              include_path='.;c:\php;c:\php\pear'
              

              for it to work

                Write a Reply...